rust-lang / rust-lang/rust-clippy

Lint suggestion: warn on `use` statements already imported via the prelude

Open
#1,124 3 comments 2 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

A-lint E-medium L-unnecessary
Dominant language
Rust
Stars
13.5k
Forks
2.2k
Avg merge
2d 10h
Merged PRs (30d)
32

Description

A large number of traits, types and functions are imported into a rust crate implicitly through the standard prelude. However, when you explicitly bring one of these items in the prelude into scope using the use statement, the rust compiler doesn't warn that the use is unnecessary.

A clippy warning for this could help shave unnecessary lines. This should probably not run on crates with #![no_std]

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 reviewing how Clippy implements lints for unnecessary use statements and how it identifies items from Rust's standard prelude. Check the #![no_std] case explicitly. Done means the lint warns for redundant prelude imports while remaining inactive for no-std crates, with coverage for both cases.

Written by the indexing model from the issue text.

Assessment

Tech stack
rust
Domain
tooling
Issue type
Feature
Difficulty
3/5
Estimated time
1-2 days
Activity status
Quiet
Clarity
Mostly clear
Newbie friendliness
48/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.