Skip to content

Commit 61c1601

Browse files
committed
merge if condition for early return
1 parent 4445942 commit 61c1601

File tree

1 file changed

+3
-5
lines changed

1 file changed

+3
-5
lines changed

src/missed_spans.rs

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -95,15 +95,13 @@ impl<'a> FmtVisitor<'a> {
9595
let snippet = self.snippet(span);
9696

9797
// Do nothing for spaces in the beginning of the file
98-
if start == BytePos(0) && end.0 as usize == snippet.len() && snippet.trim().is_empty() {
98+
let is_start_span =
99+
(start == BytePos(0) && end.0 as usize == snippet.len()) || self.is_start_span(span);
100+
if is_start_span && snippet.trim().is_empty() {
99101
return;
100102
}
101103

102104
if snippet.trim().is_empty() && !out_of_file_lines_range!(self, span) {
103-
if self.is_start_span(span) {
104-
return;
105-
}
106-
107105
// Keep vertical spaces within range.
108106
self.push_vertical_spaces(count_newlines(snippet));
109107
process_last_snippet(self, "", snippet);

0 commit comments

Comments
 (0)