Skip to content

Commit e3f9bce

Browse files
committed
Use let...else instead of match foo { ... _ => return }; and if let ... else return
1 parent 2298c01 commit e3f9bce

File tree

2 files changed

+3
-9
lines changed

2 files changed

+3
-9
lines changed

src/debuginfo/unwind.rs

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -130,11 +130,9 @@ impl UnwindContext {
130130
return;
131131
}
132132

133-
let unwind_info = if let Some(unwind_info) =
133+
let Some(unwind_info) =
134134
context.compiled_code().unwrap().create_unwind_info(module.isa()).unwrap()
135-
{
136-
unwind_info
137-
} else {
135+
else {
138136
return;
139137
};
140138

src/optimize/peephole.rs

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -29,11 +29,7 @@ pub(crate) fn maybe_known_branch_taken(
2929
arg: Value,
3030
test_zero: bool,
3131
) -> Option<bool> {
32-
let arg_inst = if let ValueDef::Result(arg_inst, 0) = bcx.func.dfg.value_def(arg) {
33-
arg_inst
34-
} else {
35-
return None;
36-
};
32+
let ValueDef::Result(arg_inst, 0) = bcx.func.dfg.value_def(arg) else { return None };
3733

3834
match bcx.func.dfg.insts[arg_inst] {
3935
InstructionData::UnaryImm { opcode: Opcode::Iconst, imm } => {

0 commit comments

Comments
 (0)