rust-lang / rust-lang/rust-analyzer

applying quick fix for clippy warning does not remove unused imports

Open
#17,822 0 comments 5 reactions 0 assignees View on GitHub

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: 0.4.2064-standalone

rustc version: rustc 1.80.0 (051478957 2024-07-21)

editor or extension: Code oss

relevant settings: None

code snippet to reproduce:

use core::mem::size_of;

pub const USIZE_BITS: usize = size_of::<usize>() * 8;

This code (correctly) gives the clippy warning clippy::manual_bits. Fixing this with clippy (cargo clippy --fix) will remove the unused import, but fixing it with rust-analyzer ("Quick fix" menu) does not remove it.

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 by reproducing the Rust snippet in the issue and compare rust-analyzer's Quick Fix with cargo clippy --fix. Trace the quick-fix handling for the clippy::manual_bits diagnostic; done means the rust-analyzer fix also removes the now-unused import.

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
Clearly specified
Newbie friendliness
65/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.