-
Notifications
You must be signed in to change notification settings - Fork 13k
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
add Formatter::debug #49068
add Formatter::debug #49068
Conversation
r? @kennytm (rust_highfive has picked a reviewer for you, use r? to override) |
r? @sfackler |
In the example, why not simply use |
Per discussion with @kennytm on #rust-libs I updated the example to one where you can't use the above snippet (since there's a diff btw |
Why only for |
If we had done the fmt traits "right" their method names would match the type names rather than all being pub trait Display {
fn fmt(&self, fmt: &mut fmt::Formatter) -> fmt::Result;
fn display(&self, fmt: &mut fmt::Formatter) -> fmt::Result {
self.fmt(fmt)
}
} |
@sfackler This will cause new methods named |
Adding new methods to a trait will cause new methods to appear, yeah. This would not be the first time we've added methods to a trait. We'd want to run crater to see if there's a surprising amount of breakage like we did for e.g. |
Sure, but these are not like super useful method that would be commonly used, so I prefer not to take the risk here :D |
Hmm; while I agree on @sfackler's point that @ollie27 I can change to include |
☔ The latest upstream changes (presumably #48978) made this pull request unmergeable. Please resolve the merge conflicts. |
That's not for me to decide; but I think @sfackler suggested addition tries to solve a different issue, that |
The asymmetry is with |
Indeed it is.
Personally, it bugs me a bit, but not much. Shall I close the PR then? |
Yeah I'd lean towards closing. |
Alright, closing then =) |
Adds (to
std::fmt::Formatter
):which is intended to aid in
Debug
impls and read better thanD::fmt(&d, fmt)
.