Skip to content

Remove duplicate trait bound or where clause #8674

Closed
@aldhsu

Description

@aldhsu

What it does

This lint warns about repetitions of the same trait in trait bounds or where clauses.

Lint Name

repetition_where_clause_or_trait_bound

Category

pedantic

Advantage

Leaving duplicate trait bounds is less readable.

Drawbacks

None

Example

pub fn foo<T: Copy + Copy>(t: T) {}

Could be written as:

pub fn foo<T: Copy>(t: T) {}

OR

pub fn foo<T>(t: T) where T: Copy + Copy {}

Could be written as:

pub fn foo<T>(t: T) where T: Copy {}

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-lintArea: New lints

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions