forked from rust-lang/rust-clippy
-
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Rollup merge of rust-lang#4544 - JoshMcguigan:issue-4542, r=flip1995
rust-lang#4542 remove machine applicable suggestion This helps rust-lang#4542 (but does not completely resolve) by removing the machine applicable suggestion (which was incorrect) for that case. I would have preferred to fix the machine applicable suggestion to handle format strings, but that's a bit beyond my current understanding of the clippy codebase. I'd be happy to give it a try given some guidance. changelog: only produce machine applicable suggestions on `explicit_write` lint
- Loading branch information
Showing
3 changed files
with
20 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
#![allow(unused_imports, clippy::blacklisted_name)] | ||
#![warn(clippy::explicit_write)] | ||
|
||
fn main() { | ||
use std::io::Write; | ||
let bar = "bar"; | ||
writeln!(std::io::stderr(), "foo {}", bar).unwrap(); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
error: use of `writeln!(stderr(), ...).unwrap()`. Consider using `eprintln!` instead | ||
--> $DIR/explicit_write_non_rustfix.rs:7:5 | ||
| | ||
LL | writeln!(std::io::stderr(), "foo {}", bar).unwrap(); | ||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | ||
| | ||
= note: `-D clippy::explicit-write` implied by `-D warnings` | ||
|
||
error: aborting due to previous error | ||
|