Change tuple Debug impls to use builders#26913
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