Description
Given the existence of {}
and the Default
trait, there's no real value in {:i}
, {:u}
, {:t}
, etc. other than for providing very rudimentary type checking for the parameters passed to format!
.
It would be simpler to just use {}
everywhere and only use specifiers for things like changing the base of printed integers (that is, only keep specifiers such as {:x}
which actually affect the way the printing is done).
If specifiers are only used for changing the base of printed integers, then their implementation can be simplified to just setting a current base member of the format which would be available to the implementation of the formatting in the Default
trait, instead of using a trait per each specifier.
This way we'd end up with having to implement just one trait for printing any type, including number-like types, instead of having to implement multiple traits (one per base).