Code
pub fn f(x: f64){
println!("{x:>8.2}%", "foo");
}
Current output
error: argument never used
--> src/lib.rs:2:27
|
2 | println!("{x:>8.2}%", "foo");
| ^^^^^ argument never used
|
note: format specifiers use curly braces, and the conversion specifier `
` is unknown or unsupported
--> src/lib.rs:2:23
|
2 | println!("{x:>8.2}%", "foo");
| ^^
= note: printf formatting is not supported; see the documentation for `std::fmt`
Desired output
error: argument never used
--> src/lib.rs:2:27
|
2 | println!("{x:>8.2}%", "foo");
| ^^^^^ argument never used
|
Rationale and extra context
I think it is quite common to format a float as a percentage.
The error message tries very hard to explain that rust doesn't use %d for users coming from C, but i think that diagnostics should be suppressed when the formatting string ends in "%", because it screws up the "note: " formatting (the empty string gets converted to a newline somewhere).
Other cases
Rust Version
rustc 1.96.0 (ac68faa20 2026-05-25)
binary: rustc
commit-hash: ac68faa20c58cbccd01ee7208bf3b6e93a7d7f96
commit-date: 2026-05-25
host: x86_64-unknown-linux-gnu
release: 1.96.0
LLVM version: 22.1.2
Anything else?
No response
Code
Current output
Desired output
Rationale and extra context
I think it is quite common to format a float as a percentage.
The error message tries very hard to explain that rust doesn't use %d for users coming from C, but i think that diagnostics should be suppressed when the formatting string ends in "%", because it screws up the "note: " formatting (the empty string gets converted to a newline somewhere).
Other cases
Rust Version
Anything else?
No response