We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
EmitterWriter::get_max_line_num
1 parent 6b6a79b commit 7b4c5c6Copy full SHA for 7b4c5c6
src/librustc_errors/emitter.rs
@@ -1022,15 +1022,11 @@ impl EmitterWriter {
1022
}
1023
1024
fn get_max_line_num(&mut self, span: &MultiSpan, children: &[SubDiagnostic]) -> usize {
1025
-
1026
let primary = self.get_multispan_max_line_num(span);
1027
- let mut max = primary;
1028
1029
- for sub in children {
1030
- let sub_result = self.get_multispan_max_line_num(&sub.span);
1031
- max = std::cmp::max(sub_result, max);
1032
- }
1033
- max
+ children.iter()
+ .map(|sub| self.get_multispan_max_line_num(&sub.span))
+ .max()
+ .unwrap_or(primary)
1034
1035
1036
/// Adds a left margin to every line but the first, given a padding length and the label being
0 commit comments