4 #![warn(clippy::derive_partial_eq_without_eq)]
6 // Don't warn on structs that aren't PartialEq
7 pub struct NotPartialEq {
12 // Eq can be derived but is missing
13 #[derive(Debug, PartialEq)]
14 pub struct MissingEq {
20 #[derive(PartialEq, Eq)]
21 pub struct NotMissingEq {
26 // Eq is manually implemented
28 pub struct ManualEqImpl {
33 impl Eq for ManualEqImpl {}
35 // Cannot be Eq because f32 isn't Eq
37 pub struct CannotBeEq {
42 // Don't warn if PartialEq is manually implemented
43 pub 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 pub struct GenericNotEq<T: Eq, U: PartialEq> {
62 pub struct GenericEq<T: Eq, U: Eq> {
68 pub struct TupleStruct(u32);
71 pub struct GenericTupleStruct<T: Eq>(T);
74 pub struct TupleStructNotEq(f32);
79 Bar { a: String, b: () },
83 pub 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 pub struct RustFixWithOtherDerives;
99 pub struct Generic<T>(T);
101 #[derive(PartialEq, Eq)]
102 pub struct GenericPhantom<T>(core::marker::PhantomData<T>);
106 pub struct Reexported;
112 pub(crate) struct PubCrate;
115 pub(super) struct PubSuper;
118 pub use _hidden::Reexported;
119 pub fn _from_mod() -> _hidden::InPubFn {