chore: justify the remaining keep-only cast + serde-default allows with reasons

This commit is contained in:
damocles 2026-06-06 13:38:46 +02:00
commit f9fe3280f9
3 changed files with 13 additions and 3 deletions

View file

@ -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
}