mirror of
https://github.com/rust-lang/rust.git
synced 2025-01-19 11:12:43 +00:00
Fix line length calculation (should be in chars, not bytes)
This commit is contained in:
parent
b4833a8c58
commit
b53aeebbcf
@ -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);
|
||||
|
4
tests/source/max-line-length-in-chars.rs
Normal file
4
tests/source/max-line-length-in-chars.rs
Normal file
@ -0,0 +1,4 @@
|
||||
// rustfmt-max_width: 25
|
||||
|
||||
// абвгдеёжзийклмнопрст
|
||||
fn main() {}
|
4
tests/target/max-line-length-in-chars.rs
Normal file
4
tests/target/max-line-length-in-chars.rs
Normal file
@ -0,0 +1,4 @@
|
||||
// rustfmt-max_width: 25
|
||||
|
||||
// абвгдеёжзийклмнопрст
|
||||
fn main() {}
|
Loading…
Reference in New Issue
Block a user