Skip to content

Style lint suggestion: deny duplicate methods of trait bounds #5777

Closed
@rossmacarthur

Description

@rossmacarthur

What it does

Checks for cases where generics are being used and multiple syntax specifications for trait bounds are used simultaneously.

Categories

  • Kind: clippy::style, clippy::pedantic

Drawbacks

Perhaps there are contexts where this communicates information clearer?

Example

fn func<T: Clone + Default>(arg: T)
where
    T: Clone + Default,
{
    todo!()
}

Could be written as:

fn func<T: Clone + Default>(arg: T) {
    todo!()
}

or

fn func<T>(arg: T)
where
    T: Clone + Default,
{
    todo!()
}

or

fn func(arg: impl Clone + Default) {
    todo!()
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-lintArea: New lintsgood first issueThese issues are a good way to get started with Clippy

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions