]> git.lizzy.rs Git - rust.git/commitdiff
Fix tidy
authorEsteban Küber <esteban@kuber.com.ar>
Wed, 14 Aug 2019 18:44:56 +0000 (11:44 -0700)
committerEsteban Küber <esteban@kuber.com.ar>
Wed, 21 Aug 2019 18:56:20 +0000 (11:56 -0700)
src/librustc_errors/emitter.rs
src/test/ui/terminal-width/non-whitespace-trimming-2.rs
src/test/ui/terminal-width/non-whitespace-trimming.rs
src/test/ui/terminal-width/whitespace-trimming-2.rs
src/test/ui/terminal-width/whitespace-trimming.rs

index 6bb151d19b32bbe2ab4d44aab345a6934ac65c66..a78a4365633f761e54f1a447fb4e6cc448d15570 100644 (file)
@@ -367,7 +367,8 @@ fn draw_line(
             &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 @@ fn render_source_line(
         //   ^^ ^ ^^^ ^^^^ ^^^ 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 @@ fn emit_message_default(
                 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);
                     }
                 }
 
index 31e979702ffd4e896c17734c7d70965ac793242e..b1ef6b95f25ce20337b50a0490b23a08be661dfb 100644 (file)
@@ -1,4 +1,4 @@
-// ignore-tidy-length 
+// ignore-tidy-linelength
 
 fn main() {
     let _: () = (); let _: () = (); let _: () = (); let _: () = (); let _: () = (); let _: () = (); let _: () = (); let _: () = (); let _: () = (); let _: () = (); let _: () = (); let _: () = (); let _: () = (); let _: () = (); let _: () = 42; let _: () = (); let _: () = (); let _: () = (); let _: () = (); let _: () = (); let _: () = (); let _: () = (); let _: () = (); let _: () = (); let _: () = (); let _: () = (); let _: () = (); let _: () = (); let _: () = (); let _: () = (); let _: () = (); let _: () = (); let _: () = (); let _: () = (); let _: () = (); let _: () = (); let _: () = (); let _: () = (); let _: () = ();
index 791e8a592d1abde8f72339235e87996e1044a227..f6c8d345c652e89226f96b5c0bdc157679bebb44 100644 (file)
@@ -1,4 +1,4 @@
-// ignore-tidy-length 
+// ignore-tidy-linelength
 
 fn main() {
     let _: () = (); let _: () = (); let _: () = (); let _: () = (); let _: () = (); let _: () = (); let _: () = (); let _: () = (); let _: () = (); let _: () = (); let _: () = (); let _: () = (); let _: () = (); let _: () = (); let _: () = 42; let _: () = (); let _: () = (); let _: () = (); let _: () = (); let _: () = (); let _: () = (); let _: () = (); let _: () = ();
index bc02c685dc9509b3208ea7fa8e471e8079ddcd0d..c68f678aab3495a7dcc4cd6fc7f9c627a96326bf 100644 (file)
@@ -1,4 +1,4 @@
-// ignore-tidy-length 
+// ignore-tidy-linelength
 
 fn foo() -> usize {
                                                                                                                                                                                           ()
index 427ed1e72e48ae6776339332ed81fe3da614ce35..f747bcf17e0b427992a72926029dba912cd0b181 100644 (file)
@@ -1,4 +1,4 @@
-// ignore-tidy-length 
+// ignore-tidy-linelength
 
 fn main() {
                                                                                                                                                                                     let _: () = 42;