Skip to content

Commit 2da0471

Browse files
committed
♻️ Use div_duration_f64 for duration calculation
Replaces manual division with the div_duration_f64 method for calculating duration units, now that the minimum supported Rust version allows its usage.
1 parent 14b4d3c commit 2da0471

File tree

1 file changed

+1
-3
lines changed

1 file changed

+1
-3
lines changed

cli/src/utils/fmt.rs

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,9 +19,7 @@ impl fmt::Display for DurationDisplay {
1919
}
2020

2121
let (unit, name, alt) = UNITS[idx];
22-
// TODO: use `div_duration_f64` when msrv be come 1.80
23-
// let mut t = self.0.div_duration_f64(unit).round() as usize;
24-
let mut t = (self.0.as_secs_f64() / unit.as_secs_f64()).round() as usize;
22+
let mut t = self.0.div_duration_f64(unit).round() as usize;
2523
if idx < UNITS.len() - 1 {
2624
t = Ord::max(t, 2);
2725
}

0 commit comments

Comments
 (0)