Skip to content

Commit 67f7707

Browse files
committed
Use let/else to reduce some indentation.
1 parent d400c43 commit 67f7707

File tree

1 file changed

+16
-17
lines changed

1 file changed

+16
-17
lines changed

compiler/rustc_mir_transform/src/coroutine.rs

+16-17
Original file line numberDiff line numberDiff line change
@@ -570,24 +570,23 @@ fn transform_async_context<'tcx>(tcx: TyCtxt<'tcx>, body: &mut Body<'tcx>) {
570570

571571
fn eliminate_get_context_call<'tcx>(bb_data: &mut BasicBlockData<'tcx>) -> Local {
572572
let terminator = bb_data.terminator.take().unwrap();
573-
if let TerminatorKind::Call { args, destination, target, .. } = terminator.kind {
574-
let [arg] = *Box::try_from(args).unwrap();
575-
let local = arg.node.place().unwrap().local;
576-
577-
let arg = Rvalue::Use(arg.node);
578-
let assign = Statement {
579-
source_info: terminator.source_info,
580-
kind: StatementKind::Assign(Box::new((destination, arg))),
581-
};
582-
bb_data.statements.push(assign);
583-
bb_data.terminator = Some(Terminator {
584-
source_info: terminator.source_info,
585-
kind: TerminatorKind::Goto { target: target.unwrap() },
586-
});
587-
local
588-
} else {
573+
let TerminatorKind::Call { args, destination, target, .. } = terminator.kind else {
589574
bug!();
590-
}
575+
};
576+
let [arg] = *Box::try_from(args).unwrap();
577+
let local = arg.node.place().unwrap().local;
578+
579+
let arg = Rvalue::Use(arg.node);
580+
let assign = Statement {
581+
source_info: terminator.source_info,
582+
kind: StatementKind::Assign(Box::new((destination, arg))),
583+
};
584+
bb_data.statements.push(assign);
585+
bb_data.terminator = Some(Terminator {
586+
source_info: terminator.source_info,
587+
kind: TerminatorKind::Goto { target: target.unwrap() },
588+
});
589+
local
591590
}
592591

593592
#[cfg_attr(not(debug_assertions), allow(unused))]

0 commit comments

Comments
 (0)