]> git.lizzy.rs Git - rust.git/commitdiff
visitor: Make sure to don't eat or realign items when they should be skipped due...
authorEmilio Cobos Álvarez <emilio@crisal.io>
Sat, 29 Jul 2017 15:06:50 +0000 (17:06 +0200)
committerEmilio Cobos Álvarez <emilio@crisal.io>
Mon, 31 Jul 2017 08:14:58 +0000 (09:14 +0100)
Before this patch, stuff like the argument with the comment was realigned to
column 0, even when being outside of the file_lines range.

src/utils.rs
tests/source/file-lines-item.rs
tests/target/file-lines-item.rs

index 9c1717e8638999040723a59c481df7a662fc1c52..47ce5e7fcbe1258fbe5ab37a90f08e772e6e9a95 100644 (file)
@@ -343,6 +343,7 @@ macro_rules! skip_out_of_file_lines_range {
 macro_rules! skip_out_of_file_lines_range_visitor {
     ($self:ident, $span:expr) => {
         if out_of_file_lines_range!($self, $span) {
+            $self.push_rewrite($span, None);
             return;
         }
     }
index 41043d873ac3fbcc845dd94f479cbefb0b2905c6..2f856c004e848fb2c20893beec58f9dfe871d328 100644 (file)
@@ -10,3 +10,11 @@ impl Drop for Context {
      fn drop(&mut self) {
     }
 }
+
+impl Bar for Baz {
+    fn foo() {
+        bar(
+            baz, // Who knows?
+        )
+    }
+}
index b5561040ac6ebd5d9d0be867d133c3e072da103f..f0908cba56a93894b1a764e50879eb54c86e247c 100644 (file)
@@ -10,3 +10,11 @@ impl Drop for Context {
      fn drop(&mut self) {
     }
 }
+
+impl Bar for Baz {
+    fn foo() {
+        bar(
+            baz, // Who knows?
+        )
+    }
+}