Rollup merge of #86407 - LingMan:map-or, r=LeSeulArtichaut
Use `map_or` instead of open-coding it `@rustbot` modify labels +C-cleanup +T-compiler
This commit is contained in:
commit
b6e234c6cf
@ -1205,12 +1205,9 @@ impl<'mir, 'tcx> MutVisitor<'tcx> for ConstPropagator<'mir, 'tcx> {
|
|||||||
let mut eval_to_int = |op| {
|
let mut eval_to_int = |op| {
|
||||||
// This can be `None` if the lhs wasn't const propagated and we just
|
// This can be `None` if the lhs wasn't const propagated and we just
|
||||||
// triggered the assert on the value of the rhs.
|
// triggered the assert on the value of the rhs.
|
||||||
match self.eval_operand(op, source_info) {
|
self.eval_operand(op, source_info).map_or(DbgVal::Underscore, |op| {
|
||||||
Some(op) => DbgVal::Val(
|
DbgVal::Val(self.ecx.read_immediate(&op).unwrap().to_const_int())
|
||||||
self.ecx.read_immediate(&op).unwrap().to_const_int(),
|
})
|
||||||
),
|
|
||||||
None => DbgVal::Underscore,
|
|
||||||
}
|
|
||||||
};
|
};
|
||||||
let msg = match msg {
|
let msg = match msg {
|
||||||
AssertKind::DivisionByZero(op) => {
|
AssertKind::DivisionByZero(op) => {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user