mirror of
https://github.com/rust-lang/rust.git
synced 2024-12-11 08:05:12 +00:00
68b44986de
Add `explicit_write` suggestions for `write!`s with format args changelog: Add [`explicit_write`] suggestions for `write!`s with format args Fixes #4542 ```rust 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 ```rust 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!()` |
||
---|---|---|
.. | ||
src | ||
Cargo.toml | ||
README.md |