mirror of
https://github.com/rust-lang/rust.git
synced 2024-11-30 18:53:39 +00:00
Merge pull request #758 from cassiersg/issue-717
Fix issue with windows line endings (#717).
This commit is contained in:
commit
cb085fc9ad
@ -337,6 +337,7 @@ pub fn fmt_lines(file_map: &mut FileMap, config: &Config) -> FormatReport {
|
||||
|
||||
for (c, b) in text.chars() {
|
||||
if c == '\r' {
|
||||
line_len += c.len_utf8();
|
||||
continue;
|
||||
}
|
||||
|
||||
@ -367,7 +368,7 @@ pub fn fmt_lines(file_map: &mut FileMap, config: &Config) -> FormatReport {
|
||||
last_wspace = None;
|
||||
} else {
|
||||
newline_count = 0;
|
||||
line_len += 1;
|
||||
line_len += c.len_utf8();
|
||||
if c.is_whitespace() {
|
||||
if last_wspace.is_none() {
|
||||
last_wspace = Some(b);
|
||||
|
Loading…
Reference in New Issue
Block a user