fix: Rust 1.95 clippy — match guards + map_or
CI / check (push) Has been cancelled

Rust 1.95 promoted collapsible_match and map_unwrap_or; CI runs
-D warnings so they break the build. Collapse nested `if`s into
match guards across codegen/optimizer/export, and swap
map().unwrap_or(..) for map_or / is_ok_and.
This commit is contained in:
2026-04-21 17:00:21 +02:00
parent a66435c93c
commit d5acdc0e7b
5 changed files with 40 additions and 48 deletions
+22 -24
View File
@@ -2012,14 +2012,12 @@ fn emit_promoted_op(f: &mut Function, op: &IrOp, sim: &mut StackSim) {
// Outside loops, RFetch shouldn't appear in promoted code
}
IrOp::LoopJ => {
if sim.loop_index_stack.len() >= 2 {
let (outer_index, _) = sim.loop_index_stack[sim.loop_index_stack.len() - 2];
let result = sim.alloc();
f.instruction(&Instruction::LocalGet(outer_index));
f.instruction(&Instruction::LocalSet(result));
sim.push(result);
}
IrOp::LoopJ if sim.loop_index_stack.len() >= 2 => {
let (outer_index, _) = sim.loop_index_stack[sim.loop_index_stack.len() - 2];
let result = sim.alloc();
f.instruction(&Instruction::LocalGet(outer_index));
f.instruction(&Instruction::LocalSet(result));
sim.push(result);
}
IrOp::Exit => {
@@ -2147,15 +2145,15 @@ fn needs_f64_locals(ops: &[IrOp]) -> bool {
return true;
}
}
IrOp::DoLoop { body, .. } | IrOp::BeginUntil { body } | IrOp::BeginAgain { body } => {
if needs_f64_locals(body) {
return true;
}
IrOp::DoLoop { body, .. } | IrOp::BeginUntil { body } | IrOp::BeginAgain { body }
if needs_f64_locals(body) =>
{
return true;
}
IrOp::BeginWhileRepeat { test, body } => {
if needs_f64_locals(test) || needs_f64_locals(body) {
return true;
}
IrOp::BeginWhileRepeat { test, body }
if needs_f64_locals(test) || needs_f64_locals(body) =>
{
return true;
}
IrOp::BeginDoubleWhileRepeat {
outer_test,
@@ -2209,15 +2207,15 @@ fn body_needs_return_stack(ops: &[IrOp]) -> bool {
return true;
}
}
IrOp::DoLoop { body, .. } | IrOp::BeginUntil { body } | IrOp::BeginAgain { body } => {
if body_needs_return_stack(body) {
return true;
}
IrOp::DoLoop { body, .. } | IrOp::BeginUntil { body } | IrOp::BeginAgain { body }
if body_needs_return_stack(body) =>
{
return true;
}
IrOp::BeginWhileRepeat { test, body } => {
if body_needs_return_stack(test) || body_needs_return_stack(body) {
return true;
}
IrOp::BeginWhileRepeat { test, body }
if body_needs_return_stack(test) || body_needs_return_stack(body) =>
{
return true;
}
IrOp::BeginDoubleWhileRepeat {
outer_test,