(
total: usize,
infos: &std::collections::BTreeMap<String, usize>,
)
| 889 | } |
| 890 | |
| 891 | fn format_hunk_aggregate_info( |
| 892 | total: usize, |
| 893 | infos: &std::collections::BTreeMap<String, usize>, |
| 894 | ) -> String { |
| 895 | if total == 1 { |
| 896 | return infos |
| 897 | .keys() |
| 898 | .next() |
| 899 | .cloned() |
| 900 | .unwrap_or_else(|| "(1 hunk)".to_string()); |
| 901 | } |
| 902 | |
| 903 | let details = infos |
| 904 | .iter() |
| 905 | .map(|(info, count)| format!("{}x {}", count, trim_hunk_info(info))) |
| 906 | .collect::<Vec<_>>() |
| 907 | .join("; "); |
| 908 | format!("({} hunks: {})", total, details) |
| 909 | } |
| 910 | |
| 911 | fn trim_hunk_info(info: &str) -> &str { |
| 912 | info.strip_prefix('(') |
no test coverage detected