rust/tests/ui/macros/format-empty-block-unit-tuple-suggestion-130170.stderr
surechen ceced5322c Special treatment empty tuple when suggest adding a string literal in format macro.
For example:
```rust
let s = "123";
println!({}, "sss", s);
```
Suggest:
`println!("{:?} {} {}", {}, "sss", s);`

fixes #130170
2024-10-14 10:07:57 +08:00

47 lines
1.3 KiB
Plaintext

error: format argument must be a string literal
--> $DIR/format-empty-block-unit-tuple-suggestion-130170.rs:5:14
|
LL | println!({}, "sss", s);
| ^^
|
help: you might be missing a string literal to format with
|
LL | println!("{:?} {} {}", {}, "sss", s);
| +++++++++++++
error: format argument must be a string literal
--> $DIR/format-empty-block-unit-tuple-suggestion-130170.rs:7:14
|
LL | println!({});
| ^^
|
help: you might be missing a string literal to format with
|
LL | println!("{:?}", {});
| +++++++
error: format argument must be a string literal
--> $DIR/format-empty-block-unit-tuple-suggestion-130170.rs:9:14
|
LL | println!(s, "sss", s, {});
| ^
|
help: you might be missing a string literal to format with
|
LL | println!("{} {} {} {:?}", s, "sss", s, {});
| ++++++++++++++++
error: format argument must be a string literal
--> $DIR/format-empty-block-unit-tuple-suggestion-130170.rs:11:14
|
LL | println!((), s, {});
| ^^
|
help: you might be missing a string literal to format with
|
LL | println!("{:?} {} {:?}", (), s, {});
| +++++++++++++++
error: aborting due to 4 previous errors