Improve suggestion for missing fmt str in println
Avoid using `concat!(fmt, "\n")` to improve the diagnostics being emitted when the first `println!()` argument isn't a formatting string literal.
This commit is contained in:
parent
bc14d71622
commit
f53c145ef1
14 changed files with 122 additions and 102 deletions
|
@ -10,8 +10,10 @@
|
|||
|
||||
fn main() {
|
||||
println!("{");
|
||||
//~^ ERROR invalid format string: expected `'}'` but string was terminated
|
||||
println!("{{}}");
|
||||
println!("}");
|
||||
//~^ ERROR invalid format string: unmatched `}` found
|
||||
let _ = format!("{_foo}", _foo = 6usize);
|
||||
//~^ ERROR invalid format string: invalid argument name `_foo`
|
||||
let _ = format!("{_}", _ = 6usize);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue