Skip to content

Commit 6d2afa1

Browse files
committed
restructure is_structual_partial_eq
1 parent e85e715 commit 6d2afa1

File tree

1 file changed

+4
-10
lines changed

1 file changed

+4
-10
lines changed

clippy_lints/src/equatable_if_let.rs

Lines changed: 4 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -65,16 +65,10 @@ 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-
// TODO: add a MSRV test once `eq` becomes stably-const
73-
self.eq_method
74-
.is_some_and(|eq_method| is_stable_const_fn(cx, eq_method, self.msrv))
75-
} else {
76-
false
77-
}
68+
(self.eq_trait).is_some_and(|eq_trait| implements_trait(cx, ty, eq_trait, &[other.into()]))
69+
&& (!is_in_const_context(cx)
70+
// TODO: add a MSRV test once `eq` becomes stably-const
71+
|| (self.eq_method).is_some_and(|eq_method| is_stable_const_fn(cx, eq_method, self.msrv)))
7872
}
7973
}
8074

0 commit comments

Comments
 (0)