6
Add `explicit_write` suggestions for `write!`s with format args by Alexendoo · P...
source link: https://github.com/rust-lang/rust-clippy/pull/8365
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.
changelog: Add [explicit_write
] suggestions for write!
s with format args
Fixes #4542
writeln!(std::io::stderr(), "macro arg {}", one!()).unwrap();
Now suggests:
error: use of `writeln!(stderr(), ...).unwrap()`
--> $DIR/explicit_write.rs:36:9
|
LL | writeln!(std::io::stderr(), "macro arg {}", one!()).unwrap();
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try this: `eprintln!("macro arg {}", one!())`
r? @camsteffen (again, sorry ) for the FormatArgsExpn
change
Before this change inputs_span
returned a span pointing to just 1
in
macro_rules! one { () => { 1 }; } `writeln!(std::io::stderr(), "macro arg {}", one!()).unwrap();`
And the source_callsite
of that span didn't include the format string, it was just one!()
Recommend
About Joyk
Aggregate valuable and interesting links.
Joyk means Joy of geeK