Skip to content
This repository was archived by the owner on May 28, 2025. It is now read-only.

Commit 84702bc

Browse files
authored
Merge pull request rust-lang#3266 from wada314/fix-2973
Fix issue rust-lang#3265
2 parents e60f4bb + e37f468 commit 84702bc

File tree

3 files changed

+33
-0
lines changed

3 files changed

+33
-0
lines changed

src/comment.rs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1321,6 +1321,11 @@ impl<'a> Iterator for LineClasses<'a> {
13211321
}
13221322
}
13231323

1324+
// Workaround for CRLF newline.
1325+
if line.ends_with('\r') {
1326+
line.pop();
1327+
}
1328+
13241329
Some((self.kind, line))
13251330
}
13261331
}

tests/source/issue-3265.rs

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
// rustfmt-newline_style: Windows
2+
#[cfg(test)]
3+
mod test {
4+
summary_test! {
5+
tokenize_recipe_interpolation_eol,
6+
"foo: # some comment
7+
{{hello}}
8+
",
9+
"foo: \
10+
{{hello}} \
11+
{{ahah}}",
12+
"N:#$>^{N}$<.",
13+
}
14+
}

tests/target/issue-3265.rs

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
// rustfmt-newline_style: Windows
2+
#[cfg(test)]
3+
mod test {
4+
summary_test! {
5+
tokenize_recipe_interpolation_eol,
6+
"foo: # some comment
7+
{{hello}}
8+
",
9+
"foo: \
10+
{{hello}} \
11+
{{ahah}}",
12+
"N:#$>^{N}$<.",
13+
}
14+
}

0 commit comments

Comments
 (0)