-
Notifications
You must be signed in to change notification settings - Fork 12.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
padding in format args doesn't work with debug impls #46006
Comments
Each implementation of a |
Yeah this is "intentional" in the sense that it's not expected to work. We likely want to be more clear about this in the documentation though |
Oh, interesting. I thought padding was imposed externally. OK, that's a shame. It'd be useful I think to have in std::fmt some wrappers that "impose" formatting from the outside -- e.g., I often wish that instead of using a flag like use std::fmt;
...
format!("{}", fmt::padded(&foo, 22)) where use std::fmt;
....
format!("{}", fmt::padded(fmt::debug(&foo), 22)) I should just make some things like this in the compiler I guess. Anyway. I'll close then! |
easy work around:
|
#59933 mentions this in the docs. |
Make clear that format padding doesn't work for Debug As mentioned in rust-lang#46006 (comment)
Make clear that format padding doesn't work for Debug As mentioned in rust-lang#46006 (comment)
Make clear that format padding doesn't work for Debug As mentioned in rust-lang#46006 (comment)
Make clear that format padding doesn't work for Debug As mentioned in rust-lang#46006 (comment)
This:
prints what I expect:
But this:
prints
Hello "x"!
(play), not:Is this intentional? If so, the format docs are pretty misleading. Otherwise, a regression perhaps? I'm not sure what is...T-libs?
cc @alexcrichton
The text was updated successfully, but these errors were encountered: