Skip to content

Commit

Permalink
fix: cap summary reporter percentage decimals
Browse files Browse the repository at this point in the history
  • Loading branch information
onbjerg committed Jun 3, 2022
1 parent 55c2148 commit be8ec7d
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion forge/src/coverage.rs
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ impl CoverageReporter for SummaryReporter {
fn format_cell(hits: usize, total: usize) -> Cell {
let percentage = if total == 0 { 1. } else { hits as f64 / total as f64 };

Cell::new(format!("{}% ({hits}/{total})", percentage * 100.)).fg(match percentage {
Cell::new(format!("{:.2}% ({hits}/{total})", percentage * 100.)).fg(match percentage {
_ if percentage < 0.5 => Color::Red,
_ if percentage < 0.75 => Color::Yellow,
_ => Color::Green,
Expand Down

0 comments on commit be8ec7d

Please sign in to comment.