clippy happier
This commit is contained in:
@@ -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
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user