rust-lang / rust-lang/rust-analyzer
"Remove all the unused imports" assist removes used derive macros
Nobody has claimed this yet.
- Dominant language
- Rust
- Stars
- 16.9k
- Forks
- 2.2k
- Avg merge
- 1d 12h
- Merged PRs (30d)
- 72
Description
For the following code:
use serde::{Deserialize, Serialize};
#[derive(Serialize, Deserialize)]
struct MyStruct {
field: i32,
}
fn main() {
println!("Hello, world!");
}
The "remove all the unused imports" assist is suggested for the use block.
If applied, it will remove the imports, even though they are being used by a derive macro.
rust-analyzer version 0.3.1615-standalone
rustc version: rustc 1.73.0-nightly (04abc370b 2023-07-28)
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
Reproduce the issue with the serde example in the report and invoke the “remove all the unused imports” assist on its use block. Trace the assist's unused-import handling and verify that imports referenced only by derive macros are retained while genuinely unused imports are removed.
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
- 45/100