rust-lang / rust-lang/rust-analyzer
Feature request: Unwrap tuple
Open
Nobody has claimed this yet.
A-assists
A-pattern
C-feature
S-actionable
- Dominant language
- Rust
- Stars
- 16.9k
- Forks
- 2.2k
- Avg merge
- 1d 12h
- Merged PRs (30d)
- 72
Description
Sometimes, during refactoring, you can end up with assignments like
let (foo, bar) = (expr_a, expr_b);
It would be nice if rust-analyzer had an assist to turn this into
let foo = expr_a;
let bar = expr_b;
The same could also be helpful for
let StructStruct { a, b } = StructStruct { a: expr_a, b: expr_b };
or
let TupleStruct(a, b) = TupleStruct(expr_a, expr_b);
though I haven't seen one of those in the real world yet.
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 locating rust-analyzer's existing assists for destructuring or refactoring and their tests. Implement support for tuple assignments first, then assess whether struct and tuple-struct patterns fit the same behavior. Done means the requested assignment is split into separate bindings and the assist is covered by tests.
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
- Mostly clear
- Newbie friendliness
- 45/100