Join GitHub today
GitHub is home to over 31 million developers working together to host and review code, manage projects, and build software together.
Sign upadd Formatter::debug #49068
Conversation
Centril
added
C-enhancement
T-libs
labels
Mar 16, 2018
Centril
requested a review
from
sfackler
Mar 16, 2018
rust-highfive
assigned
kennytm
Mar 16, 2018
This comment has been minimized.
This comment has been minimized.
|
r? @kennytm (rust_highfive has picked a reviewer for you, use r? to override) |
rust-highfive
added
the
S-waiting-on-review
label
Mar 16, 2018
This comment has been minimized.
This comment has been minimized.
|
r? @sfackler |
rust-highfive
assigned
sfackler
and unassigned
kennytm
Mar 16, 2018
This comment has been minimized.
This comment has been minimized.
|
In the example, why not simply use |
This comment has been minimized.
This comment has been minimized.
|
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 |
This comment has been minimized.
This comment has been minimized.
|
Why only for |
This comment has been minimized.
This comment has been minimized.
|
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)
}
} |
This comment has been minimized.
This comment has been minimized.
|
@sfackler This will cause new methods named |
This comment has been minimized.
This comment has been minimized.
|
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. |
This comment has been minimized.
This comment has been minimized.
|
Sure, but these are not like super useful method that would be commonly used, so I prefer not to take the risk here :D |
This comment has been minimized.
This comment has been minimized.
|
Hmm; while I agree on @sfackler's point that @ollie27 I can change to include |
This comment has been minimized.
This comment has been minimized.
|
|
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
That's not for me to decide; but I think @sfackler suggested addition tries to solve a different issue, that |
This comment has been minimized.
This comment has been minimized.
|
The asymmetry is with |
This comment has been minimized.
This comment has been minimized.
Indeed it is.
Personally, it bugs me a bit, but not much. Shall I close the PR then? |
This comment has been minimized.
This comment has been minimized.
|
Yeah I'd lean towards closing. |
This comment has been minimized.
This comment has been minimized.
|
Alright, closing then =) |
Centril commentedMar 16, 2018
Adds (to
std::fmt::Formatter):which is intended to aid in
Debugimpls and read better thanD::fmt(&d, fmt).