From eb8b23134096de269fb927014c44776fd30ec8ba Mon Sep 17 00:00:00 2001 From: NotAShelf Date: Sat, 28 Feb 2026 23:33:16 +0300 Subject: [PATCH] chore: collapse if statements; autofix Clippy warnings Signed-off-by: NotAShelf Change-Id: I2765a6864b5435d803472b0fba313d7e6a6a6964 --- Cargo.toml | 1 + crates/common/src/notifications.rs | 2 ++ crates/common/src/repo/build_outputs.rs | 5 ++--- crates/queue-runner/src/runner_loop.rs | 5 ++--- 4 files changed, 7 insertions(+), 6 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index e1d01b5..3d5bf5c 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -109,6 +109,7 @@ similar_names = "allow" single_call_fn = "allow" std_instead_of_core = "allow" too_long_first_doc_paragraph = "allow" +too_many_arguments = "allow" # I don't care too_many_lines = "allow" undocumented_unsafe_blocks = "warn" unnecessary_safety_comment = "warn" diff --git a/crates/common/src/notifications.rs b/crates/common/src/notifications.rs index 2e57c2b..ae7e817 100644 --- a/crates/common/src/notifications.rs +++ b/crates/common/src/notifications.rs @@ -28,6 +28,7 @@ pub struct RateLimitState { pub reset_at: u64, } +#[must_use] pub fn extract_rate_limit_from_headers( headers: &reqwest::header::HeaderMap, ) -> Option { @@ -37,6 +38,7 @@ pub fn extract_rate_limit_from_headers( Some(RateLimitState { limit, remaining, reset_at }) } +#[must_use] pub fn calculate_delay(state: &RateLimitState, now: u64) -> u64 { let seconds_until_reset = state.reset_at.saturating_sub(now).max(1); let consumed = state.limit.saturating_sub(state.remaining); diff --git a/crates/common/src/repo/build_outputs.rs b/crates/common/src/repo/build_outputs.rs index 558cbdc..66ed5b5 100644 --- a/crates/common/src/repo/build_outputs.rs +++ b/crates/common/src/repo/build_outputs.rs @@ -28,13 +28,12 @@ pub async fn create( .fetch_one(pool) .await .map_err(|e| { - if let sqlx::Error::Database(db_err) = &e { - if db_err.is_unique_violation() { + if let sqlx::Error::Database(db_err) = &e + && db_err.is_unique_violation() { return CiError::Conflict(format!( "Build output with name '{name}' already exists for build {build}" )); } - } CiError::Database(e) }) } diff --git a/crates/queue-runner/src/runner_loop.rs b/crates/queue-runner/src/runner_loop.rs index 4f3f24f..aa3655b 100644 --- a/crates/queue-runner/src/runner_loop.rs +++ b/crates/queue-runner/src/runner_loop.rs @@ -209,8 +209,8 @@ pub async fn run( } // Unsupported system timeout: abort builds with no available builders - if let Some(timeout) = unsupported_timeout { - if let Some(system) = &build.system { + if let Some(timeout) = unsupported_timeout + && let Some(system) = &build.system { match repo::remote_builders::find_for_system(&pool, system).await { Ok(builders) if builders.is_empty() => { let timeout_at = build.created_at + timeout; @@ -252,7 +252,6 @@ pub async fn run( }, } } - } // One-at-a-time scheduling: check if jobset allows concurrent builds // First, get the evaluation to find the jobset