mirror of
https://github.com/rust-lang/rust.git
synced 2024-11-27 01:04:03 +00:00
Use map_or
instead of open-coding it
This commit is contained in:
parent
0ef2b4a29b
commit
382ba79380
@ -1205,12 +1205,9 @@ impl<'mir, 'tcx> MutVisitor<'tcx> for ConstPropagator<'mir, 'tcx> {
|
||||
let mut eval_to_int = |op| {
|
||||
// This can be `None` if the lhs wasn't const propagated and we just
|
||||
// triggered the assert on the value of the rhs.
|
||||
match self.eval_operand(op, source_info) {
|
||||
Some(op) => DbgVal::Val(
|
||||
self.ecx.read_immediate(&op).unwrap().to_const_int(),
|
||||
),
|
||||
None => DbgVal::Underscore,
|
||||
}
|
||||
self.eval_operand(op, source_info).map_or(DbgVal::Underscore, |op| {
|
||||
DbgVal::Val(self.ecx.read_immediate(&op).unwrap().to_const_int())
|
||||
})
|
||||
};
|
||||
let msg = match msg {
|
||||
AssertKind::DivisionByZero(op) => {
|
||||
|
Loading…
Reference in New Issue
Block a user