avoid unnecessary nested conditionals

This commit is contained in:
Ralf Jung 2023-11-08 20:37:08 +01:00
parent 03b24f2756
commit 30588657b7

View File

@ -228,8 +228,7 @@ impl<'tcx> ConstToPat<'tcx> {
}
}
}
} else if !self.saw_const_match_lint.get() {
if !have_valtree {
} else if !have_valtree && !self.saw_const_match_lint.get() {
// The only way valtree construction can fail without the structural match
// checker finding a violation is if there is a pointer somewhere.
self.tcx().emit_spanned_lint(
@ -239,7 +238,6 @@ impl<'tcx> ConstToPat<'tcx> {
PointerPattern,
);
}
}
// Always check for `PartialEq`, even if we emitted other lints. (But not if there were
// any errors.) This ensures it shows up in cargo's future-compat reports as well.