Skip to content

Commit 77be56b

Browse files
committed
fix(analysis-stats): divided by zero error
1 parent 2f8cd66 commit 77be56b

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

crates/rust-analyzer/src/cli/analysis_stats.rs

+3-3
Original file line numberDiff line numberDiff line change
@@ -227,7 +227,7 @@ impl flags::AnalysisStats {
227227
fail += 1;
228228
}
229229
eprintln!("{:<20} {}", "Data layouts:", sw.elapsed());
230-
eprintln!("Failed data layouts: {fail} ({}%)", fail * 100 / all);
230+
eprintln!("Failed data layouts: {fail} ({}%)", percentage(fail, all));
231231
report_metric("failed data layouts", fail, "#");
232232
}
233233

@@ -254,7 +254,7 @@ impl flags::AnalysisStats {
254254
fail += 1;
255255
}
256256
eprintln!("{:<20} {}", "Const evaluation:", sw.elapsed());
257-
eprintln!("Failed const evals: {fail} ({}%)", fail * 100 / all);
257+
eprintln!("Failed const evals: {fail} ({}%)", percentage(fail, all));
258258
report_metric("failed const evals", fail, "#");
259259
}
260260

@@ -280,7 +280,7 @@ impl flags::AnalysisStats {
280280
fail += 1;
281281
}
282282
eprintln!("{:<20} {}", "MIR lowering:", sw.elapsed());
283-
eprintln!("Mir failed bodies: {fail} ({}%)", fail * 100 / all);
283+
eprintln!("Mir failed bodies: {fail} ({}%)", percentage(fail, all));
284284
report_metric("mir failed bodies", fail, "#");
285285
}
286286

0 commit comments

Comments
 (0)