Open EnderNon opened 1 week ago
it's worth noting that {}
is a valid rust expression, it evaluates to the empty tuple.
this is perfectly valid code:
fn main() {
println!("{:?}", {});
}
minimal repro:
fn main() {
println!({});
}
huh, didn't know that. good to know ig
I think it is worth special casing this in diagnostics though, if someone wanted to print a unit type (for some reason?) they probably should use the ()
value or just embed it directly in the format string. An empty {}
expression as the first argument of a format macro is almost certainly a mistake.
Code
Current output
Desired output
Rationale and extra context
Cargo does not seem to be detecting the {} outside brackets and provides an incredibly strange fix instead.
Other cases
No response
Rust Version
Anything else?
the file is from here: https://github.com/Wynntils/Static-Storage/blob/main/Reference/id_keys.json
You will need serde_json crate.