From 02cbc39fa42eff2e459a70e72db776f8feb76d1b Mon Sep 17 00:00:00 2001 From: Wes Date: Tue, 21 Apr 2026 15:33:00 -0700 Subject: [PATCH] fix: resolve pre-existing clippy collapsible_match warnings Collapse nested if blocks into match guard patterns in messages.rs and ingest.rs to satisfy clippy::collapsible_match. Co-Authored-By: Claude Opus 4.6 (1M context) --- crates/sprout-relay/src/api/messages.rs | 8 ++++---- crates/sprout-relay/src/handlers/ingest.rs | 12 ++++-------- 2 files changed, 8 insertions(+), 12 deletions(-) diff --git a/crates/sprout-relay/src/api/messages.rs b/crates/sprout-relay/src/api/messages.rs index ef80c0d80..80917442b 100644 --- a/crates/sprout-relay/src/api/messages.rs +++ b/crates/sprout-relay/src/api/messages.rs @@ -129,11 +129,11 @@ pub fn validate_imeta_tags(tags: &[Vec], media_base_url: &str) -> Result return Err("imeta duration must be a valid float".into()); } } - "bitrate" => { + "bitrate" // NIP-71 standard field: bits/sec as integer, positive - if value.parse::().map_or(true, |b| b == 0) { - return Err("imeta bitrate must be a positive integer".into()); - } + if value.parse::().map_or(true, |b| b == 0) => + { + return Err("imeta bitrate must be a positive integer".into()); } "image" => { // NIP-71 poster frame — must be a local media URL with an image extension. diff --git a/crates/sprout-relay/src/handlers/ingest.rs b/crates/sprout-relay/src/handlers/ingest.rs index 901a6bfa0..0d7824643 100644 --- a/crates/sprout-relay/src/handlers/ingest.rs +++ b/crates/sprout-relay/src/handlers/ingest.rs @@ -727,15 +727,11 @@ fn validate_diff_event(event: &Event) -> Result<(), String> { return Err("parent-commit SHA must be at least 7 hex characters".to_string()); } } - "branch" => { - if parts.len() < 3 || parts[1].is_empty() || parts[2].is_empty() { - return Err("branch tag requires both source and target".to_string()); - } + "branch" if (parts.len() < 3 || parts[1].is_empty() || parts[2].is_empty()) => { + return Err("branch tag requires both source and target".to_string()); } - "pr" => { - if parts[1].parse::().map(|n| n == 0).unwrap_or(true) { - return Err("pr number must be a positive integer".to_string()); - } + "pr" if parts[1].parse::().map(|n| n == 0).unwrap_or(true) => { + return Err("pr number must be a positive integer".to_string()); } _ => {} }