mirror of
https://github.com/rust-lang/rust.git
synced 2024-12-05 13:13:40 +00:00
Handle cases when bound changed from the default
This commit is contained in:
parent
2302e904e9
commit
04449c6622
@ -88,11 +88,9 @@ impl<'a> FmtVisitor<'a> {
|
||||
|
||||
fn push_vertical_spaces(&mut self, mut newline_count: usize) {
|
||||
// The buffer already has a trailing newline.
|
||||
if self.buffer.cur_offset() == 0 {
|
||||
newline_count = newline_count.checked_sub(1).unwrap_or(0);
|
||||
}
|
||||
let newline_upper_bound = self.config.blank_lines_upper_bound() + 1;
|
||||
let newline_lower_bound = self.config.blank_lines_lower_bound() + 1;
|
||||
let offset = if self.buffer.cur_offset() == 0 { 0 } else { 1 };
|
||||
let newline_upper_bound = self.config.blank_lines_upper_bound() + offset;
|
||||
let newline_lower_bound = self.config.blank_lines_lower_bound() + offset;
|
||||
if newline_count > newline_upper_bound {
|
||||
newline_count = newline_upper_bound;
|
||||
} else if newline_count < newline_lower_bound {
|
||||
|
Loading…
Reference in New Issue
Block a user