Simplify EmitterWriter::get_max_line_num
This commit is contained in:
parent
6b6a79b190
commit
7b4c5c62aa
1 changed files with 4 additions and 8 deletions
|
|
@ -1022,15 +1022,11 @@ impl EmitterWriter {
|
|||
}
|
||||
|
||||
fn get_max_line_num(&mut self, span: &MultiSpan, children: &[SubDiagnostic]) -> usize {
|
||||
|
||||
let primary = self.get_multispan_max_line_num(span);
|
||||
let mut max = primary;
|
||||
|
||||
for sub in children {
|
||||
let sub_result = self.get_multispan_max_line_num(&sub.span);
|
||||
max = std::cmp::max(sub_result, max);
|
||||
}
|
||||
max
|
||||
children.iter()
|
||||
.map(|sub| self.get_multispan_max_line_num(&sub.span))
|
||||
.max()
|
||||
.unwrap_or(primary)
|
||||
}
|
||||
|
||||
/// Adds a left margin to every line but the first, given a padding length and the label being
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue