From 577911ccbc02f36082ac1a0a8f876b59ec77020c Mon Sep 17 00:00:00 2001 From: Ben Boeckel Date: Fri, 4 Apr 2025 09:02:21 +0200 Subject: [PATCH] clippy: fix `manual_repeat_n` lint --- ghostflow-github/src/client.rs | 3 +-- ghostflow-gitlab/src/lib.rs | 5 ++--- 2 files changed, 3 insertions(+), 5 deletions(-) diff --git a/ghostflow-github/src/client.rs b/ghostflow-github/src/client.rs index 77a9b168..07f4b943 100644 --- a/ghostflow-github/src/client.rs +++ b/ghostflow-github/src/client.rs @@ -351,8 +351,7 @@ fn retry_with_backoff(mut tryf: F) -> GithubResult where F: FnMut() -> GithubResult, { - iter::repeat(()) - .take(BACKOFF_LIMIT) + iter::repeat_n((), BACKOFF_LIMIT) .scan(BACKOFF_START, |timeout, _| { match tryf() { Ok(r) => Some(Some(Ok(r))), diff --git a/ghostflow-gitlab/src/lib.rs b/ghostflow-gitlab/src/lib.rs index b485fe4f..6e850cff 100644 --- a/ghostflow-gitlab/src/lib.rs +++ b/ghostflow-gitlab/src/lib.rs @@ -64,8 +64,7 @@ where F: FnMut() -> Result>, E: std::error::Error + Send + Sync + 'static, { - iter::repeat(()) - .take(BACKOFF_LIMIT) + iter::repeat_n((), BACKOFF_LIMIT) .scan(BACKOFF_START, |timeout, _| { match tryf() { Ok(r) => Some(Some(Ok(r))), @@ -640,7 +639,7 @@ impl HostingService for GitlabService { let token_name = format!("ghostflow-impersonation-{}-{}", user.handle, reason); let today = Utc::now().date_naive(); // Add up to 2 days so that tokens created at a date boundary do not expire before use. - let expires_at = iter::repeat(()).take(2).fold(today, |day, _| { + let expires_at = iter::repeat_n((), 2).fold(today, |day, _| { if let Some(after) = day.succ_opt() { after } else { -- GitLab