From f9fe3280f9a8dc1df253d91da105500e4dcd67d4 Mon Sep 17 00:00:00 2001 From: damocles Date: Sat, 6 Jun 2026 13:38:46 +0200 Subject: [PATCH] chore: justify the remaining keep-only cast + serde-default allows with reasons --- hive-bash-mcp/src/bin/mcp.rs | 5 ++++- hive-c0re/src/hive_stats.rs | 6 +++++- hive-forge/src/verbs/comments.rs | 5 ++++- 3 files changed, 13 insertions(+), 3 deletions(-) diff --git a/hive-bash-mcp/src/bin/mcp.rs b/hive-bash-mcp/src/bin/mcp.rs index 544d39d9..af7a4b54 100644 --- a/hive-bash-mcp/src/bin/mcp.rs +++ b/hive-bash-mcp/src/bin/mcp.rs @@ -168,7 +168,10 @@ struct BashRunArgs { wait_seconds: Option, } -#[allow(clippy::unnecessary_wraps)] +#[allow( + clippy::unnecessary_wraps, + reason = "serde `#[serde(default = ...)]` requires the default fn's return type to match the field's `Option`, so the `Some` wrap is mandatory even though the value is constant" +)] fn default_wait() -> Option { Some(3) } diff --git a/hive-c0re/src/hive_stats.rs b/hive-c0re/src/hive_stats.rs index e70f984d..7f23b7df 100644 --- a/hive-c0re/src/hive_stats.rs +++ b/hive-c0re/src/hive_stats.rs @@ -167,7 +167,11 @@ fn now_secs() -> i64 { .map_or(0, |d| i64::try_from(d.as_secs()).unwrap_or(i64::MAX)) } -#[allow(clippy::cast_sign_loss, clippy::cast_possible_truncation)] +#[allow( + clippy::cast_sign_loss, + clippy::cast_possible_truncation, + reason = "v.max(0) clamps to a non-negative value first, so the i64->u64 cast is exact: no sign loss, and no truncation since u64 covers all non-negative i64" +)] fn u64_from_i64(v: i64) -> u64 { v.max(0) as u64 } diff --git a/hive-forge/src/verbs/comments.rs b/hive-forge/src/verbs/comments.rs index a294260f..026bbc1a 100644 --- a/hive-forge/src/verbs/comments.rs +++ b/hive-forge/src/verbs/comments.rs @@ -99,7 +99,10 @@ fn fetch_head(client: &Client, repo: &str, number: u64, limit: u64) -> Result Result> { if n == 0 { return Ok(Vec::new());