Skip to content

Commit

Permalink
Merge pull request rust-lang#3266 from wada314/fix-2973
Browse files Browse the repository at this point in the history
Fix issue rust-lang#3265
  • Loading branch information
topecongiro authored Dec 25, 2018
2 parents e60f4bb + e37f468 commit 84702bc
Show file tree
Hide file tree
Showing 3 changed files with 33 additions and 0 deletions.
5 changes: 5 additions & 0 deletions src/comment.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1321,6 +1321,11 @@ impl<'a> Iterator for LineClasses<'a> {
}
}

// Workaround for CRLF newline.
if line.ends_with('\r') {
line.pop();
}

Some((self.kind, line))
}
}
Expand Down
14 changes: 14 additions & 0 deletions tests/source/issue-3265.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
// rustfmt-newline_style: Windows
#[cfg(test)]
mod test {
summary_test! {
tokenize_recipe_interpolation_eol,
"foo: # some comment
{{hello}}
",
"foo: \
{{hello}} \
{{ahah}}",
"N:#$>^{N}$<.",
}
}
14 changes: 14 additions & 0 deletions tests/target/issue-3265.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
// rustfmt-newline_style: Windows
#[cfg(test)]
mod test {
summary_test! {
tokenize_recipe_interpolation_eol,
"foo: # some comment
{{hello}}
",
"foo: \
{{hello}} \
{{ahah}}",
"N:#$>^{N}$<.",
}
}

0 comments on commit 84702bc

Please sign in to comment.