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

False positive for write! with format string that ends with an escaped backslash followed by 'n' #3514

Closed
james-bostock opened this issue Dec 8, 2018 · 0 comments
Labels
C-bug Category: Clippy is not doing the correct thing

Comments

@james-bostock
Copy link

james-bostock commented Dec 8, 2018

The Clippy lint for calls to write! ,whose format string ends with a newline (\n), erroneously flags the case where the backslash itself is escaped (\\n). For example, the following Rust code triggers the warning:

use std::io;
use std::io::Write;

fn main() -> std::io::Result<()> {
    write!(io::stdout(), "\\n")?;
    Ok(())
}

I am using the following version of Clippy:

$ cargo clippy -V
clippy 0.0.212 (2e26fdc 2018-11-22)

Thanks for creating such a great utility!

@phansch phansch added the C-bug Category: Clippy is not doing the correct thing label Dec 10, 2018
bors added a commit that referenced this issue Dec 12, 2018
Fix write_with_newline escaping false positive

Fixes #3514
bors added a commit that referenced this issue Dec 14, 2018
Fix write_with_newline escaping false positive

Fixes #3514
bors added a commit that referenced this issue Dec 14, 2018
Fix write_with_newline escaping false positive

Fixes #3514
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
Projects
None yet
Development

No branches or pull requests

2 participants