]> git.lizzy.rs Git - rust.git/commitdiff
Process blank lines if only they're within file lines range
authorSeiichi Uchida <seuchida@gmail.com>
Tue, 5 Dec 2017 08:14:30 +0000 (17:14 +0900)
committerSeiichi Uchida <seuchida@gmail.com>
Tue, 5 Dec 2017 08:14:57 +0000 (17:14 +0900)
src/missed_spans.rs

index b25f15b48805512c9ef76e64bb4486883deb2434..ba99bdd92c045f89cef045009ef1824d8be985c9 100644 (file)
@@ -13,6 +13,7 @@
 
 use syntax::codemap::{BytePos, Pos, Span};
 
+use codemap::LineRangeUtils;
 use comment::{rewrite_comment, CodeCharKind, CommentCodeSlices};
 use config::WriteMode;
 use shape::{Indent, Shape};
@@ -76,7 +77,7 @@ fn format_missing_inner<F: Fn(&mut FmtVisitor, &str, &str)>(
         self.last_pos = end;
         let span = mk_sp(start, end);
         let snippet = self.snippet(span);
-        if snippet.trim().is_empty() {
+        if snippet.trim().is_empty() && !out_of_file_lines_range!(self, span) {
             // Keep vertical spaces within range.
             self.push_vertical_spaces(count_newlines(&snippet));
             process_last_snippet(self, "", &snippet);