Skip to content

Commit 04449c6

Browse files
committed
Handle cases when bound changed from the default
1 parent 2302e90 commit 04449c6

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
@@ -88,11 +88,9 @@ impl<'a> FmtVisitor<'a> {
8888

8989
fn push_vertical_spaces(&mut self, mut newline_count: usize) {
9090
// The buffer already has a trailing newline.
91-
if self.buffer.cur_offset() == 0 {
92-
newline_count = newline_count.checked_sub(1).unwrap_or(0);
93-
}
94-
let newline_upper_bound = self.config.blank_lines_upper_bound() + 1;
95-
let newline_lower_bound = self.config.blank_lines_lower_bound() + 1;
91+
let offset = if self.buffer.cur_offset() == 0 { 0 } else { 1 };
92+
let newline_upper_bound = self.config.blank_lines_upper_bound() + offset;
93+
let newline_lower_bound = self.config.blank_lines_lower_bound() + offset;
9694
if newline_count > newline_upper_bound {
9795
newline_count = newline_upper_bound;
9896
} else if newline_count < newline_lower_bound {

0 commit comments

Comments
 (0)