-
Notifications
You must be signed in to change notification settings - Fork 963
Labels
C-feature-requestCategory: a feature request (not decided/implemented)Category: a feature request (not decided/implemented)P-lowLow priorityLow priority
Description
I've noticed what I consider to be an unfortunate decision in rustfmt: the moment a single doc-comment is added in an enum, the whole enum is laid out with a line per field, even when no fields are documented.
That is, the type:
enum MyType {
A { field1: bool, field2: bool },
B { field1: bool, field2: bool },
/// OMG a comment
C { field1: bool, field2: bool },
D { field1: bool, field2: bool },
}becomes
enum MyType {
A {
field1: bool,
field2: bool,
},
B {
field1: bool,
field2: bool,
},
/// OMG a comment
C {
field1: bool,
field2: bool,
},
D {
field1: bool,
field2: bool,
},
}The formatting policy I would like would leave the type unchanged. If a doc-comment is added to a single field of a variant, then only that variant should be broken up on multiple lines rather than the whole type.
is this something that could potentially be customizable as an option in rustfmt.toml? If so, I would be happy to implement this if someone can point be in the right direction.
Metadata
Metadata
Assignees
Labels
C-feature-requestCategory: a feature request (not decided/implemented)Category: a feature request (not decided/implemented)P-lowLow priorityLow priority