Multi-line struct field values should begin on the same line
Nobody has claimed this yet.
- Dominant language
- Rust
- Stars
- 7k
- Forks
- 1.1k
- Avg merge
- 2d 13h
- Merged PRs (30d)
- 24
Description
I would like to see struct field values start on the same line as the field name even when the expression takes multiple lines.
Config: version=Two and max_width=50.
Current:
let Struct {
tuplestruct:
TupleStruct(
Foo {
message: "hi friend",
array:
[
loooooooooooooong,
loooooooooooooong,
],
},
looooooooong,
),
..
} = x;
Desired:
let Struct {
tuplestruct: TupleStruct(
Foo {
message: "hi friend",
array: [
loooooooooooooong,
loooooooooooooong,
],
},
looooooooong,
),
..
} = x;
This draws your attention to the field names more than their values, making it easier to scan the overall structure without getting distracted by the values. Also it can drastically reduce indentation for patterns with a lot of nesting.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Reproduce the supplied Rust pattern with rustfmt using Config: version=Two and max_width=50, then inspect the formatter path responsible for struct pattern fields and multiline expressions. Done means the field value begins on the field-name line while preserving the shown wrapping and indentation.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- rust
- Domain
- tooling
- Issue type
- Feature
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Clearly specified
- Newbie friendliness
- 35/100