]> git.lizzy.rs Git - rust.git/commitdiff
Fixed issue from #64447
authorhman523 <shbarbella@gmail.com>
Mon, 23 Sep 2019 23:20:21 +0000 (18:20 -0500)
committerhman523 <shbarbella@gmail.com>
Mon, 23 Sep 2019 23:20:21 +0000 (18:20 -0500)
src/librustc_errors/emitter.rs

index fc441320e003919df9eef990995a6b4f3d0e4da6..c13a4b8dbb487ae733a7673875f3eb4906a48a6b 100644 (file)
@@ -1043,14 +1043,13 @@ fn get_multispan_max_line_num(&mut self, msp: &MultiSpan) -> usize {
     }
 
     fn get_max_line_num(&mut self, span: &MultiSpan, children: &[SubDiagnostic]) -> usize {
-        let mut max = 0;
 
         let primary = self.get_multispan_max_line_num(span);
-        max = if primary > max { primary } else { max };
+        let mut max = primary;
 
         for sub in children {
             let sub_result = self.get_multispan_max_line_num(&sub.span);
-            max = if sub_result > max { primary } else { max };
+            max = if sub_result > max { sub_result } else { max };
         }
         max
     }