clippy happier

This commit is contained in:
2025-05-07 00:00:21 +02:00
parent a401d4de7b
commit 26da6b39cc
17 changed files with 234 additions and 236 deletions

View File

@@ -1,9 +1,10 @@
pub trait LimitPrecision {
fn to_precision(self, presision: i32) -> Self;
fn to_precision(self, precision: i32) -> Self;
}
impl LimitPrecision for f32 {
fn to_precision(self, precision: i32) -> Self {
(self * (10_f32).powi(precision)).round() / (10_f32).powi(precision)
let factor = 10_f32.powi(precision);
(self * factor).round() / factor
}
}
}