4 #![warn(clippy::derive_partial_eq_without_eq)]
6 // Don't warn on structs that aren't PartialEq
12 // Eq can be derived but is missing
13 #[derive(Debug, PartialEq)]
20 #[derive(PartialEq, Eq)]
26 // Eq is manually implemented
33 impl Eq for ManualEqImpl {}
35 // Cannot be Eq because f32 isn't Eq
42 // Don't warn if PartialEq is manually implemented
43 struct ManualPartialEqImpl {
48 impl PartialEq for ManualPartialEqImpl {
49 fn eq(&self, other: &Self) -> bool {
50 self.foo == other.foo && self.bar == other.bar
54 // Generic fields should be properly checked for Eq-ness
56 struct GenericNotEq<T: Eq, U: PartialEq> {
62 struct GenericEq<T: Eq, U: Eq> {
68 struct TupleStruct(u32);
71 struct GenericTupleStruct<T: Eq>(T);
74 struct TupleStructNotEq(f32);
79 Bar { a: String, b: () },
83 enum GenericEnum<T: Eq, U: Eq, V: Eq> {
91 Bar { a: String, b: f32 },
94 // Ensure that rustfix works properly when `PartialEq` has other derives on either side
95 #[derive(Debug, PartialEq, Clone)]
96 struct RustFixWithOtherDerives;