return values instead of wrapping them in needless results
This commit is contained in:
@@ -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
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user