`match` indentation broken for tuple-closing brackets
Nobody has claimed this yet.
- Dominant language
- Rust
- Stars
- 7k
- Forks
- 1.1k
- Avg merge
- 2d 13h
- Merged PRs (30d)
- 24
Description
The following snippet is formatted using rustfmt.
match Some(1) {
Some(number) => (
"aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
number,
)
.to_owned(),
None => ("test", 0).to_owned(),
};
In my opinion, this is not very readable since it breaks the strict indentation of anything inside a match arm. Shouldn't the closing bracket of the tuple in the Some(_) arm be indented further (and therefore, potentially, the two fields of the tuple as well)?
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
Start by reproducing the provided match-arm and tuple-formatting snippet with rustfmt, then trace the formatter entry point handling match arms and tuple expressions. Done means the tuple-closing bracket and its fields follow the intended match-arm indentation, with a regression test covering the example.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- rust
- Domain
- tooling
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 38/100