Skip to content

Commit ed9a6f4

Browse files
ndmitchellfacebook-github-bot
authored andcommitted
Lift out an if statement
Summary: Suggestion from clippy. Seems equally good either way. Reviewed By: JakobDegen Differential Revision: D47226536 fbshipit-source-id: 82a9eb2a85760668a545d1c7ad54c9716bb16b5d
1 parent b5f679f commit ed9a6f4

File tree

1 file changed

+5
-7
lines changed
  • starlark/src/eval/bc/compiler

1 file changed

+5
-7
lines changed

starlark/src/eval/bc/compiler/stmt.rs

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -194,14 +194,12 @@ impl IrSpanned<StmtCompiled> {
194194
expr.write_bc_cb(bc, |slot, bc| {
195195
bc.write_instr::<InstrReturnCheckType>(span, slot);
196196
});
197+
} else if let Some(value) = expr.as_value() {
198+
bc.write_instr::<InstrReturnConst>(span, value);
197199
} else {
198-
if let Some(value) = expr.as_value() {
199-
bc.write_instr::<InstrReturnConst>(span, value);
200-
} else {
201-
expr.write_bc_cb(bc, |slot, bc| {
202-
bc.write_instr::<InstrReturn>(span, slot);
203-
});
204-
}
200+
expr.write_bc_cb(bc, |slot, bc| {
201+
bc.write_instr::<InstrReturn>(span, slot);
202+
});
205203
}
206204
}
207205

0 commit comments

Comments
 (0)