]> git.lizzy.rs Git - rust.git/blob - src/tools/clippy/tests/ui/derive_hash_xor_eq.rs
Rollup merge of #89685 - DeveloperC286:iter_fields_to_private, r=oli-obk
[rust.git] / src / tools / clippy / tests / ui / derive_hash_xor_eq.rs
1 #![allow(clippy::derive_partial_eq_without_eq)]
2
3 #[derive(PartialEq, Hash)]
4 struct Foo;
5
6 impl PartialEq<u64> for Foo {
7     fn eq(&self, _: &u64) -> bool {
8         true
9     }
10 }
11
12 #[derive(Hash)]
13 struct Bar;
14
15 impl PartialEq for Bar {
16     fn eq(&self, _: &Bar) -> bool {
17         true
18     }
19 }
20
21 #[derive(Hash)]
22 struct Baz;
23
24 impl PartialEq<Baz> for Baz {
25     fn eq(&self, _: &Baz) -> bool {
26         true
27     }
28 }
29
30 #[derive(PartialEq)]
31 struct Bah;
32
33 impl std::hash::Hash for Bah {
34     fn hash<H: std::hash::Hasher>(&self, _: &mut H) {}
35 }
36
37 #[derive(PartialEq)]
38 struct Foo2;
39
40 trait Hash {}
41
42 // We don't want to lint on user-defined traits called `Hash`
43 impl Hash for Foo2 {}
44
45 mod use_hash {
46     use std::hash::{Hash, Hasher};
47
48     #[derive(PartialEq)]
49     struct Foo3;
50
51     impl Hash for Foo3 {
52         fn hash<H: std::hash::Hasher>(&self, _: &mut H) {}
53     }
54 }
55
56 fn main() {}