diff --git a/ghostflow-github/src/client.rs b/ghostflow-github/src/client.rs index 77a9b168dfda9c53406d2a750a32b86f30317d7b..07f4b9436e6ce579aff7ed981db25d91851a02f1 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 b485fe4f38a5cade4b38e95d5e17224049ae03c3..6e850cff7f82e2b62186b6c7c481e568a59d56c6 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 {