Skip to content

allow(partialeq_ne_impl) broken #2892

Closed
@gnzlbg

Description

@gnzlbg

The following Rust code (playground):

struct Foo();

impl PartialEq for Foo {
    fn eq(&self, _: &Self) -> bool {
        true
    }
    #[cfg_attr(feature = "cargo-clippy", allow(partialeq_ne_impl))]
    fn ne(&self, _: &Self) -> bool {
        false
    }
}

fn main() {}

produces the partialeq_ne_lint:

warning: re-implementing `PartialEq::ne` is unnecessary
  --> src/main.rs:8:5
   |
8  | /     fn ne(&self, _: &Self) -> bool {
9  | |         false
10 | |     }
   | |_____^
   |
   = note: #[warn(partialeq_ne_impl)] on by default
   = help: for further information visit https://rust-lang-nursery.github.io/rust-clippy/v0.0.211/index.html#partialeq_ne_impl

but it shouldn't produce it because it is allowed.

Metadata

Metadata

Assignees

No one assigned

    Labels

    C-bugCategory: Clippy is not doing the correct thing

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions