Process blank lines if only they're within file lines range

This commit is contained in:
Seiichi Uchida 2017-12-05 17:14:30 +09:00
parent 53616f63b1
commit 5632a7c075

View File

@ -13,6 +13,7 @@ use std::iter::repeat;
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 @@ impl<'a> FmtVisitor<'a> {
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);