rust-lang / rust-lang/rust-analyzer
`Remove all the unused imports` does not recognize the trait method used by `write!`
Open
Nobody has claimed this yet.
A-assists
C-bug
- Dominant language
- Rust
- Stars
- 16.9k
- Forks
- 2.2k
- Avg merge
- 1d 12h
- Merged PRs (30d)
- 72
Description
rust-analyzer version: rust-analyzer 1.80.0 (05147895 2024-07-21)
rustc version: rustc 1.80.0 (051478957 2024-07-21)
editor or extension: Vim 9.1 coc-rust-analyzer
code snippet to reproduce:
use std::fmt::Write;
fn main() {
let mut s = String::new();
write!(s, "abc").unwrap();
}
on line 1 use Remove all the unused imports:
fn main() {
let mut s = String::new();
write!(s, "abc").unwrap();
}
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 with the minimal Rust snippet and reproduce the Remove all the unused imports action. Trace how the action decides whether std::fmt::Write is unused when write! calls the trait method; done means the import is retained and the existing behavior remains covered by a regression test.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- rust
- Domain
- tooling
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100