This code:
struct Foo;
impl Display for Foo {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
write!(f, "{}", f.fill() as u32)
}
}
fn main() {
println!("{:\t}", Foo)
}
Compiles, and prints 32. According to the std::fmt docs,
[[fill]align][sign]['#']['0'][width]['.' precision][type]
is the syntax of format specifications; however, \t does not fulfill any of these elements. I assumed that it might accidentally be implementing the syntax
[fill][align][sign]['#']['0'][width]['.' precision][type]
however, if that were true, then this should print 9 (and not 32). I haven't looked into the parsing code, but will after filing this issue.
This code:
Compiles, and prints
32. According to thestd::fmtdocs,is the syntax of format specifications; however,
\tdoes not fulfill any of these elements. I assumed that it might accidentally be implementing the syntaxhowever, if that were true, then this should print
9(and not32). I haven't looked into the parsing code, but will after filing this issue.