mirror of
https://github.com/rust-lang/rust.git
synced 2026-05-08 09:38:26 +03:00
format_lines: fix line_len for config.max_width
This commit is contained in:
+2
-2
@@ -496,7 +496,7 @@ fn format_lines(text: &mut StringBuffer, name: &str, config: &Config, report: &m
|
||||
// Check for (and record) trailing whitespace.
|
||||
if let Some(lw) = last_wspace {
|
||||
trims.push((cur_line, lw, b));
|
||||
line_len -= b - lw;
|
||||
line_len -= 1;
|
||||
}
|
||||
// Check for any line width errors we couldn't correct.
|
||||
if config.error_on_line_overflow && line_len > config.max_width {
|
||||
@@ -511,7 +511,7 @@ fn format_lines(text: &mut StringBuffer, name: &str, config: &Config, report: &m
|
||||
last_wspace = None;
|
||||
} else {
|
||||
newline_count = 0;
|
||||
line_len += c.len_utf8();
|
||||
line_len += 1;
|
||||
if c.is_whitespace() {
|
||||
if last_wspace.is_none() {
|
||||
last_wspace = Some(b);
|
||||
|
||||
Reference in New Issue
Block a user