Skip to content

Commit eb20630

Browse files
committed
restructure is_structual_partial_eq
1 parent 0495c90 commit eb20630

File tree

1 file changed

+3
-9
lines changed

1 file changed

+3
-9
lines changed

clippy_lints/src/equatable_if_let.rs

Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -65,15 +65,9 @@ impl PatternEquality {
6565
}
6666

6767
fn is_structural_partial_eq<'tcx>(&self, cx: &LateContext<'tcx>, ty: Ty<'tcx>, other: Ty<'tcx>) -> bool {
68-
if (self.eq_trait).is_some_and(|eq_trait| implements_trait(cx, ty, eq_trait, &[other.into()])) {
69-
if !is_in_const_context(cx) {
70-
return true;
71-
}
72-
self.eq_method
73-
.is_some_and(|eq_method| is_stable_const_fn(cx, eq_method, self.msrv))
74-
} else {
75-
false
76-
}
68+
(self.eq_trait).is_some_and(|eq_trait| implements_trait(cx, ty, eq_trait, &[other.into()]))
69+
&& (!is_in_const_context(cx)
70+
|| (self.eq_method).is_some_and(|eq_method| is_stable_const_fn(cx, eq_method, self.msrv)))
7771
}
7872
}
7973

0 commit comments

Comments
 (0)