rust-lang / rust-lang/rust-analyzer

Combining let statements into a pattern

Open
#10,651 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

A-assists C-feature S-actionable
Dominant language
Rust
Stars
16.9k
Forks
2.2k
Avg merge
1d 12h
Merged PRs (30d)
72

Description

A nice little code action would be combining multiple let statements into a single one, like this

// Original code
let mut body = builder.translate(theta.body());
let mut outputs = BTreeMap::new();

// Code action turns it into this
let (mut body, mut outputs) = (builder.translate(theta.body()), BTreeMap::new());

The inverse would also be cool, splitting patterns into multiple bindings

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

The issue names no files or tests. Start by locating rust-analyzer’s existing code-action entry points and tests for let bindings, then assess both combining separate bindings into a tuple pattern and splitting tuple patterns into bindings. Done means both transformations behave correctly and are covered by tests.

Written by the indexing model from the issue text.

Assessment

Tech stack
rust
Domain
devtools
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.