rust-lang / rust-lang/rust-analyzer

Dont return both "Remove all unused imports" and "remove the unused import" if both are the same

Open
#17,229 1 comment 1 reaction 0 assignees View on GitHub

Nobody has claimed this yet.

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

Description

I added a keybinding that asks for only quickfix assists and applies it if there is only one. The problem is that for the unused import diagnostic rust-analyzer returns both "Remove all" and "remove", even if both have the same effect (specifically when there is only one unused import). It seems to me that if both code actions have the same edit we can ignore one.

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

Start at the unused import diagnostic's code-action generation, focusing on the "Remove all" and "remove" actions and their edits. Confirm how rust-analyzer represents and compares their edits, then verify that only one action is returned when the edits are identical while distinct actions remain available.

Written by the indexing model from the issue text.

Assessment

Tech stack
rust
Domain
devtools
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 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.