Open
Description
I tried this code:
use std::fmt;
struct A {}
impl fmt::Debug for A {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
write!(f, "1234567890")
}
}
pub fn main() {
println!("{:<.5}", "1234567890");
let a = A {};
println!("{:<.5}", format_args!("{:?}", a));
}
I expected to see this happen:
I would expect both lines print
s to print the same output.
Instead, this happened:
output is
12345
1234567890
and there is no warning that the second println!
completely ignores the formatting directives :<.5
that I passed.
Meta
rustc --version --verbose
:
rustc 1.63.0-nightly (a6b8c6954 2022-06-03)
binary: rustc
commit-hash: a6b8c6954829669a5c4fa320c3e6132edf04fcfc
commit-date: 2022-06-03
host: x86_64-unknown-linux-gnu
release: 1.63.0-nightly
LLVM version: 14.0.4