Allow a rest pattern before closing brace when destructuring
Nobody has claimed this yet.
- Dominant language
- Rust
- Stars
- 7k
- Forks
- 1.1k
- Avg merge
- 2d 13h
- Merged PRs (30d)
- 24
Description
Example for a struct:
let Self {
x,
y,
.. } = self;
match x {
Variant::A {
a,
b,
.. } => { /* snip */ }
_ => todo!(),
}
Currently a .. is placed either on a separate line, or, in case of match and/or a short list of required fields, right after the trailing comma, all on the same line. I also think the above style may serve the best for the same purpose that a trailing commas are intended for. Please consider, thanks.
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 struct and match examples from the issue with rustfmt, then locate the existing formatting behavior for destructuring rest patterns. Done means rustfmt consistently permits and preserves the shown placement of .. before the closing brace without regressing other destructuring formats.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- rust
- Domain
- tooling
- Issue type
- Feature
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 40/100