- Notifications
You must be signed in to change notification settings - Fork 971
Labels
A-commentsArea: commentsArea: commentsC-bugCategory: this is a bug; use also I-* labels for specific bug kinds, e.g. I-non-idempotency or I-ICECategory: this is a bug; use also I-* labels for specific bug kinds, e.g. I-non-idempotency or I-ICEE-help-wantedCall for participation: help is requested to fix this issueCall for participation: help is requested to fix this issue
Description
Both in relation to defining and instantiating structs, if the last field does not have a trailing comma, then rustfmt inserts one. However, if a comment is subsequently present, then it is moved up as well.
If the comma was already present, then the comment is not moved.
Before:
struct Foo { bar: () // Comment } struct Bar { baz: () /* Comment */ } struct Baz( () // Comment ); fn main() { let _ = Foo { bar: () /* Comment */ }; let _ = Bar { baz: () /* Comment */ }; let _ = Baz( () // Comment ); }After:
struct Foo { bar: (), // Comment } struct Bar { baz: (), /* Comment */ } struct Baz( (), // Comment ); fn main() { let _ = Foo { bar: (), /* Comment */ }; let _ = Bar { baz: (), /* Comment */ }; let _ = Baz( (), // Comment ); }Metadata
Metadata
Assignees
Labels
A-commentsArea: commentsArea: commentsC-bugCategory: this is a bug; use also I-* labels for specific bug kinds, e.g. I-non-idempotency or I-ICECategory: this is a bug; use also I-* labels for specific bug kinds, e.g. I-non-idempotency or I-ICEE-help-wantedCall for participation: help is requested to fix this issueCall for participation: help is requested to fix this issue