rust-lang / rust-lang/rust-clippy

Redundant trait bounds

Open
#873 2 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

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

Description

From time to time I find redundancies in my code as the result of moving trait bounds around while refactoring.

While true redundancy detection (with indirection) is probably out of scope …

trait Baz {}
trait Bar: Baz {}

trait Foo<T>
    where T: Bar {
    fn foo() where T: Baz;
}

… trivial cases like this should be totally doable:

trait Bar {}

trait Foo<T>
    where T: Bar {
    fn foo() where T: Bar;
}

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 with the two Rust examples in the issue and trace how rust-clippy implements lint checks for trait bounds. Determine how the repeated bound should be identified without attempting indirect redundancy detection. Done means the trivial redundant-bound case is reported while the indirect case remains out of scope; the payload names no files or tests.

Written by the indexing model from the issue text.

Assessment

Tech stack
rust
Domain
tooling
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 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.