Skip to content

Commit 4d119f5

Browse files
committed
refactor(timings): extract round function
1 parent 33be686 commit 4d119f5

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

src/cargo/core/compiler/timings/report.rs

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -346,7 +346,6 @@ pub(super) fn to_unit_data(
346346
unit_times: &[UnitTime],
347347
unit_map: &HashMap<Unit, u64>,
348348
) -> Vec<UnitData> {
349-
let round = |x: f64| (x * 100.0).round() / 100.0;
350349
unit_times
351350
.iter()
352351
.map(|ut| (unit_map[&ut.unit], ut))
@@ -468,6 +467,11 @@ fn aggregate_sections(unit_time: &UnitTime) -> AggregatedSections {
468467
}
469468
}
470469

470+
/// Rounds seconds to 0.01s precision.
471+
fn round(x: f64) -> f64 {
472+
(x * 100.0).round() / 100.0
473+
}
474+
471475
static HTML_TMPL: &str = r#"
472476
<html>
473477
<head>

0 commit comments

Comments
 (0)