(
total: usize,
infos: &std::collections::BTreeMap<String, usize>,
)
| 903 | } |
| 904 | |
| 905 | fn format_hunk_aggregate_info( |
| 906 | total: usize, |
| 907 | infos: &std::collections::BTreeMap<String, usize>, |
| 908 | ) -> String { |
| 909 | if total == 1 { |
| 910 | return infos |
| 911 | .keys() |
| 912 | .next() |
| 913 | .cloned() |
| 914 | .unwrap_or_else(|| "(1 hunk)".to_string()); |
| 915 | } |
| 916 | |
| 917 | let details = infos |
| 918 | .iter() |
| 919 | .map(|(info, count)| format!("{}x {}", count, trim_hunk_info(info))) |
| 920 | .collect::<Vec<_>>() |
| 921 | .join("; "); |
| 922 | format!("({} hunks: {})", total, details) |
| 923 | } |
| 924 | |
| 925 | fn trim_hunk_info(info: &str) -> &str { |
| 926 | info.strip_prefix('(') |
no test coverage detected