1
Fork 0

Tiny missed simplification

This commit is contained in:
Nadrieril 2024-03-01 19:07:08 +01:00
parent 5257aee7dd
commit 832b23ffcf

View file

@ -603,17 +603,13 @@ impl<'a, 'tcx> Builder<'a, 'tcx> {
}) })
} }
(&TestKind::If, TestCase::Constant { value }) => { (TestKind::If, TestCase::Constant { value }) => {
fully_matched = true; fully_matched = true;
let value = value.try_eval_bool(self.tcx, self.param_env).unwrap_or_else(|| { let value = value.try_eval_bool(self.tcx, self.param_env).unwrap_or_else(|| {
span_bug!(test.span, "expected boolean value but got {value:?}") span_bug!(test.span, "expected boolean value but got {value:?}")
}); });
Some(value as usize) Some(value as usize)
} }
(&TestKind::If, _) => {
fully_matched = false;
None
}
( (
&TestKind::Len { len: test_len, op: BinOp::Eq }, &TestKind::Len { len: test_len, op: BinOp::Eq },
@ -714,6 +710,7 @@ impl<'a, 'tcx> Builder<'a, 'tcx> {
( (
TestKind::Switch { .. } TestKind::Switch { .. }
| TestKind::SwitchInt { .. } | TestKind::SwitchInt { .. }
| TestKind::If
| TestKind::Len { .. } | TestKind::Len { .. }
| TestKind::Range { .. } | TestKind::Range { .. }
| TestKind::Eq { .. }, | TestKind::Eq { .. },