Change the type of argument of push_vertical_spaces()
@@ -78,15 +78,14 @@ impl<'a> FmtVisitor<'a> {
let snippet = self.snippet(span);
if snippet.trim().is_empty() {
// Keep vertical spaces within range.
- self.push_vertical_spaces(&snippet);
+ self.push_vertical_spaces(count_newlines(&snippet));
process_last_snippet(self, "", &snippet);
} else {
self.write_snippet(span, &process_last_snippet);
}
}
- fn push_vertical_spaces(&mut self, original: &str) {
- let mut newline_count = count_newlines(original);
+ fn push_vertical_spaces(&mut self, mut newline_count: usize) {
let newline_upper_bound = self.config.blank_lines_upper_bound() + 1;
let newline_lower_bound = self.config.blank_lines_lower_bound() + 1;
if newline_count > newline_upper_bound {
