-
Notifications
You must be signed in to change notification settings - Fork 13.3k
Change tuple Debug impls to use builders #26913
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
Conversation
Since it's using a macro, we could special case the unary tuple, so that we get the comma anyway? |
Yeah I think I'd prefer to keep the trailing comma on 1-tuples, but other than that r=me |
Would be nice to keep Debug output as close to something that compiles. |
Updated |
In the interest of not having lingering unstable methods, could this do what @bluss mentioned and special case the 1-tuple case? |
The machinery involved to properly handle the pretty case is involved enough (e.g. see |
Yes on a closer look it's not easy, I trust what you think is best sfackler |
Wouldn't it be something along the lines of: fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
if f.alternate_flag_enabled() {
write!(f, "({:#?},)", self.0)
} else {
write!(f, "({:?},)", self.0)
}
} |
That'd generate
but the builder would generate
|
⌛ Testing commit b0ab164 with merge 0c05219... |
This does change the Debug output for 1-tuples to `(foo)` instead of `(foo,)` but I don't think it's that big of a deal. r? @alexcrichton
This does change the Debug output for 1-tuples to
(foo)
instead of(foo,)
but I don't think it's that big of a deal.r? @alexcrichton