Skip to content

should_implement_trait does not consider function safety. #5413

@human-0

Description

@human-0

Consider this:

enum Foo(u8) { // Probably struct as well
    _1, _2, ...
}

impl Foo {
    unsafe fn add(self, rhs: u8) -> Foo { ... }
}

This triggers should_implement_trait, which a false positive, as Add requires a normal function, not an unsafe one.

cargo clippy -V:

clippy 0.0.212 (4ee12063 2020-02-01)

Metadata

Metadata

Assignees

No one assigned

    Labels

    C-enhancementCategory: Enhancement of lints, like adding more cases or adding help messagesgood 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