]> git.lizzy.rs Git - rust.git/blob - src/docs/partialeq_ne_impl.txt
Add iter_kv_map lint
[rust.git] / src / docs / partialeq_ne_impl.txt
1 ### What it does
2 Checks for manual re-implementations of `PartialEq::ne`.
3
4 ### Why is this bad?
5 `PartialEq::ne` is required to always return the
6 negated result of `PartialEq::eq`, which is exactly what the default
7 implementation does. Therefore, there should never be any need to
8 re-implement it.
9
10 ### Example
11 ```
12 struct Foo;
13
14 impl PartialEq for Foo {
15    fn eq(&self, other: &Foo) -> bool { true }
16    fn ne(&self, other: &Foo) -> bool { !(self == other) }
17 }
18 ```