Rust-clippy: write_with_newline should not warn when "\n" is preceded by "\r"

Created on 14 Jun 2019  路  7Comments  路  Source: rust-lang/rust-clippy

Writing to a file, I need CRLF format so I have no other choice than using write with \r\n.

warning: using `write!()` with a format string that ends in a single newline, consider using `writeln!()` instead
  --> src\main.rs:49:13
   |
49 |             write!(out, "{}\r\n", line)?;
   |             ^^^^^^^^^^^^^^^^^^^^^^^^^^^
   |
   = note: #[warn(clippy::write_with_newline)] on by default
   = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#write_with_newline
L-bug good-first-issue

Most helpful comment

hi @V1shvesh are you working on this issue? If not, I have a fix.

All 7 comments

Hey @Geobert @matthiaskrgr! Is this issue still relevant?

Yes it is. matthiaskrgr/rust-clippy@588dcc8 didn't fix this back then, and I think @matthiaskrgr probably forgot about this in the mean time. So feel free to take this 馃憤

Awesome!

hi @V1shvesh are you working on this issue? If not, I have a fix.

@metadave I haven't worked on it yet, so feel free! Thanks!

PR has been integrated, I'm closing this. :)

No, it's S-inactive-closed, not merged. Only thing left to do is to add a test and the PR is finished.

Was this page helpful?
0 / 5 - 0 ratings