Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

write_with_newline should not warn when "\n" is preceded by "\r" #4208

Closed
Geobert opened this issue Jun 14, 2019 · 7 comments · Fixed by #4769
Closed

write_with_newline should not warn when "\n" is preceded by "\r" #4208

Geobert opened this issue Jun 14, 2019 · 7 comments · Fixed by #4769
Labels
C-bug Category: Clippy is not doing the correct thing good-first-issue These issues are a good way to get started with Clippy

Comments

@Geobert
Copy link

Geobert commented Jun 14, 2019

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
@flip1995 flip1995 added good-first-issue These issues are a good way to get started with Clippy C-bug Category: Clippy is not doing the correct thing labels Jun 14, 2019
matthiaskrgr added a commit to matthiaskrgr/rust-clippy that referenced this issue Jun 16, 2019
@V1shvesh
Copy link

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

@flip1995
Copy link
Member

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 👍

@V1shvesh
Copy link

Awesome!

@bookshelfdave
Copy link

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

@V1shvesh
Copy link

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

@matthiaskrgr
Copy link
Member

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

@flip1995
Copy link
Member

flip1995 commented Oct 3, 2019

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

@flip1995 flip1995 reopened this Oct 3, 2019
flip1995 added a commit to flip1995/rust-clippy that referenced this issue Nov 7, 2019
don't warn on CRLF in `with_newline` lints

changelog: don't warn on CRLF in `print_with_newline` and `write_with_newline`
fixes rust-lang#4208.

This PR also transitions the unescaping logic to use the compiler's lexer.
flip1995 added a commit to flip1995/rust-clippy that referenced this issue Nov 7, 2019
don't warn on CRLF in `with_newline` lints

changelog: don't warn on CRLF in `print_with_newline` and `write_with_newline`
fixes rust-lang#4208.

This PR also transitions the unescaping logic to use the compiler's lexer.
bors added a commit that referenced this issue Nov 7, 2019
don't warn on CRLF in `with_newline` lints

changelog: don't warn on CRLF in `print_with_newline` and `write_with_newline`
fixes #4208.

This PR also transitions the unescaping logic to use the compiler's lexer.
bors added a commit that referenced this issue Nov 9, 2019
don't warn on CRLF in `with_newline` lints

changelog: don't warn on CRLF in `print_with_newline` and `write_with_newline`
fixes #4208.

This PR also transitions the unescaping logic to use the compiler's lexer.
bors added a commit that referenced this issue Nov 11, 2019
don't warn on CRLF in `with_newline` lints

changelog: don't warn on CRLF in `print_with_newline` and `write_with_newline`
fixes #4208.

This PR also transitions the unescaping logic to use the compiler's lexer.
@bors bors closed this as completed in 180f870 Nov 12, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C-bug Category: Clippy is not doing the correct thing good-first-issue These issues are a good way to get started with Clippy
Projects
None yet
5 participants