@@ -8907,8 +8907,7 @@ impl CodeInfo {
89078907 if let DeoptKind::ReturnIter { tail_start_idx } = deopt_kind {
89088908 let tail_instr_idx = real_instrs
89098909 .get(tail_start_idx)
8910- .map(|(instr_idx, _)| *instr_idx)
8911- .unwrap_or(block_instr_len);
8910+ .map_or(block_instr_len, |(instr_idx, _)| *instr_idx);
89128911 if !tail_returns_without_store(
89138912 &self.blocks,
89148913 &is_pre_handler,
@@ -9472,8 +9471,7 @@ impl CodeInfo {
94729471 block.disable_load_fast_borrow,
94739472 block
94749473 .start_depth
9475- .map(|depth| depth.to_string())
9476- .unwrap_or_else(|| String::from("None")),
9474+ .map_or_else(|| String::from("None"), |depth| depth.to_string()),
94779475 );
94789476 for info in &block.instructions {
94799477 let lineno = instruction_lineno(info);
@@ -10169,8 +10167,7 @@ fn mark_cold(blocks: &mut [Block]) {
1016910167 let has_fallthrough = block
1017010168 .instructions
1017110169 .last()
10172- .map(|ins| !ins.instr.is_scope_exit() && !ins.instr.is_unconditional_jump())
10173- .unwrap_or(true);
10170+ .is_none_or(|ins| !ins.instr.is_scope_exit() && !ins.instr.is_unconditional_jump());
1017410171 if has_fallthrough && block.next != BlockIdx::NULL {
1017510172 let next_idx = block.next.idx();
1017610173 if !blocks[next_idx].except_handler && !warm[next_idx] {
@@ -10209,11 +10206,9 @@ fn push_cold_blocks_to_end(blocks: &mut Vec<Block>) {
1020910206 block.cold
1021010207 && block.next != BlockIdx::NULL
1021110208 && !blocks[block.next.idx()].cold
10212- && block
10213- .instructions
10214- .last()
10215- .map(|ins| !ins.instr.is_scope_exit() && !ins.instr.is_unconditional_jump())
10216- .unwrap_or(true)
10209+ && block.instructions.last().is_none_or(|ins| {
10210+ !ins.instr.is_scope_exit() && !ins.instr.is_unconditional_jump()
10211+ })
1021710212 })
1021810213 .map(|(idx, block)| (idx, block.next))
1021910214 .collect();
@@ -13343,8 +13338,7 @@ fn duplicate_end_returns(blocks: &mut Vec<Block>, metadata: &CodeUnitMetadata) {
1334313338 if current != last_block && !block.cold {
1334413339 let last_ins = block.instructions.last();
1334513340 let has_fallthrough = last_ins
13346- .map(|ins| !ins.instr.is_scope_exit() && !ins.instr.is_unconditional_jump())
13347- .unwrap_or(true);
13341+ .is_none_or(|ins| !ins.instr.is_scope_exit() && !ins.instr.is_unconditional_jump());
1334813342 // Don't duplicate if block already ends with the same return pattern
1334913343 let already_has_return = block.instructions.len() >= 2 && {
1335013344 let n = block.instructions.len();
@@ -13518,8 +13512,7 @@ fn duplicate_named_except_cleanup_returns(blocks: &mut Vec<Block>, metadata: &Co
1351813512 let fallthroughs_into_target = blocks[layout_pred.idx()]
1351913513 .instructions
1352013514 .last()
13521- .map(|ins| !ins.instr.is_scope_exit() && !ins.instr.is_unconditional_jump())
13522- .unwrap_or(true);
13515+ .is_none_or(|ins| !ins.instr.is_scope_exit() && !ins.instr.is_unconditional_jump());
1352313516 if !fallthroughs_into_target || predecessors[target.idx()] < 2 {
1352413517 continue;
1352513518 }
@@ -13765,8 +13758,7 @@ pub(crate) fn label_exception_targets(blocks: &mut [Block]) {
1376513758 let has_fallthrough = blocks[bi]
1376613759 .instructions
1376713760 .last()
13768- .map(|ins| !ins.instr.is_scope_exit() && !ins.instr.is_unconditional_jump())
13769- .unwrap_or(true); // Empty block falls through
13761+ .is_none_or(|ins| !ins.instr.is_scope_exit() && !ins.instr.is_unconditional_jump()); // Empty block falls through
1377013762 if has_fallthrough {
1377113763 visited[next.idx()] = true;
1377213764 block_stacks[next.idx()] = Some(stack);
0 commit comments