return values instead of wrapping them in needless results

This commit is contained in:
2026-09-21 01:26:53 +03:00
parent b2dd93fb09
commit e6e0d5b2b4
4 changed files with 26 additions and 24 deletions
+8
View File
@@ -29,6 +29,10 @@ pub(crate) fn round_u32(v: f64) -> u32 {
clippy::cast_possible_truncation,
reason = "value is clamped into u32 range on the line above the cast"
)]
#[allow(
clippy::cast_sign_loss,
reason = "value is clamped to 0.0 or above on the line above the cast"
)]
let out = v.round().clamp(0.0, f64::from(u32::MAX)) as u32;
out
}
@@ -40,6 +44,10 @@ pub(crate) fn round_u64(v: f64) -> u64 {
clippy::cast_possible_truncation,
reason = "value is clamped into u64 range on the line above the cast"
)]
#[allow(
clippy::cast_sign_loss,
reason = "value is clamped to 0.0 or above on the line above the cast"
)]
let out = v.round().clamp(0.0, 18_446_744_073_709_551_615.0) as u64;
out
}