about summary refs log tree commit diff
path: root/src/librustc_errors
diff options
context:
space:
mode:
authorEsteban Küber <esteban@kuber.com.ar>2019-08-14 11:44:56 -0700
committerEsteban Küber <esteban@kuber.com.ar>2019-08-21 11:56:20 -0700
commit45a6be545891f4a8f19f0dce801b67fdccf435ee (patch)
treedebaa0f1f19a873642db6ef68ffd9bec9a520549 /src/librustc_errors
parentf08b036cc78ca225a8d3e25fc138ed3a210c611f (diff)
downloadrust-45a6be545891f4a8f19f0dce801b67fdccf435ee.tar.gz
rust-45a6be545891f4a8f19f0dce801b67fdccf435ee.zip
Fix tidy
Diffstat (limited to 'src/librustc_errors')
-rw-r--r--src/librustc_errors/emitter.rs21
1 files changed, 10 insertions, 11 deletions
diff --git a/src/librustc_errors/emitter.rs b/src/librustc_errors/emitter.rs
index 6bb151d19b3..a78a4365633 100644
--- a/src/librustc_errors/emitter.rs
+++ b/src/librustc_errors/emitter.rs
@@ -367,7 +367,8 @@ impl EmitterWriter {
             &source_string[margin.left(line_len)..margin.right(line_len)],
             Style::Quotation,
         );
-        if margin.was_cut_left() { // We have stripped some code/whitespace from the beginning, make it clear.
+        if margin.was_cut_left() {
+            // We have stripped some code/whitespace from the beginning, make it clear.
             buffer.puts(line_offset, code_offset, "...", Style::LineNumber);
         }
         if margin.was_cut_right(line_len) {
@@ -403,7 +404,7 @@ impl EmitterWriter {
         //   ^^ ^ ^^^ ^^^^ ^^^ we don't care about code too far to the right of a span, we trim it
         //   |  | |   |
         //   |  | |   actual code found in your source code and the spans we use to mark it
-        //   |  | when there's too much wasted space to the left, we trim it to focus where it matters
+        //   |  | when there's too much wasted space to the left, trim it
         //   |  vertical divider between the column number and the code
         //   column number
 
@@ -1251,18 +1252,16 @@ impl EmitterWriter {
                 let mut label_right_margin = 0;
                 let mut max_line_len = 0;
                 for line in &annotated_file.lines {
-                    max_line_len = max(
-                        max_line_len,
-                        annotated_file.file.get_line(line.line_index - 1).map(|s| s.len()).unwrap_or(0),
-                    );
+                    max_line_len = max(max_line_len, annotated_file.file
+                        .get_line(line.line_index - 1)
+                        .map(|s| s.len())
+                        .unwrap_or(0));
                     for ann in &line.annotations {
                         span_right_margin = max(span_right_margin, ann.start_col);
                         span_right_margin = max(span_right_margin, ann.end_col);
-                        label_right_margin = max(
-                            label_right_margin,
-                            // TODO: account for labels not in the same line
-                            ann.end_col + ann.label.as_ref().map(|l| l.len() + 1).unwrap_or(0),
-                        );
+                        // FIXME: account for labels not in the same line
+                        let label_right = ann.label.as_ref().map(|l| l.len() + 1).unwrap_or(0);
+                        label_right_margin = max(label_right_margin, ann.end_col + label_right);
                     }
                 }