Uh oh!
There was an error while loading. Please reload this page.
core: fmt: debug builders pretty print tuple structs and enum variants in a single line - #26874
core: fmt: debug builders pretty print tuple structs and enum variants in a single line#26874liigo wants to merge 1 commit into
Conversation
rust-highfive
commented
Jul 8, 2015
r? @aturon (rust_highfive has picked a reviewer for you, use r? to override) |
alexcrichton
commented
Jul 8, 2015
r? @sfackler |
sfackler
commented
Jul 8, 2015
The current behavior is intentional, as described in the RFC: rust-lang/rfcs#640. The pretty printing mode is designed for ease of readability, not matching rust style. Printing some things in one line and others in multiples does not nest well: MyTupleStruct(MyStruct{a:1,b:TupleStruct(MyOtherStruct{foo: bar
},10,"hi",Thing{baz: buzz
})},true,false,OtherStruct{thing:"hi"})It could potentially be nice to print single-variant tuples in one line if there are no line breaks in the output for the inner value, but I'm not sure how that would work. |
liigo
commented
Jul 9, 2015
OK, maybe an RFC is required to propose changing this a bit?
But I do think that
Tuples with nested struct, already pretty print in a single line, and this PR doesn't change that. http://is.gd/ZJKuVy |
sfackler
commented
Jul 9, 2015
The tuple behavior is a bug, not a feature. |
liigo
commented
Jul 10, 2015
via email
So, let's resolve it through an RFC |
liigo
commented
Jul 10, 2015
I've written an RFC rust-lang/rfcs#1198 |
bors
commented
Jul 12, 2015
☔ The latest upstream changes (presumably #26913) made this pull request unmergeable. Please resolve the merge conflicts. |
alexcrichton
commented
Sep 28, 2015
The associated RFC was closed, so I'm going to close this as well. |
Before this PR,
println!("{:#?}", Some(1));pretty prints debug output as:(by adding newlines and indent)
But I don't think it's pretty print: it's weird, even not a preferred code style.
Some(1)itself (without newlines and indent) is pretty print, IMO.This PR change the pretty print output, to print tuple structs and enum variants in a single line. (We already pretty print tuples in this way.)
Perhaps this is a [breaking-change]? And an RFC is required? I don't known.