We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 8746b79 commit 02cd72eCopy full SHA for 02cd72e
compiler/rustc_ast_lowering/src/expr.rs
@@ -442,18 +442,10 @@ impl<'hir> LoweringContext<'_, 'hir> {
442
then: &Block,
443
else_opt: Option<&Expr>,
444
) -> hir::ExprKind<'hir> {
445
- macro_rules! make_if {
446
- ($opt:expr) => {{
447
- let cond = self.lower_expr(cond);
448
- let then_expr = self.lower_block_expr(then);
449
- hir::ExprKind::If(cond, self.arena.alloc(then_expr), $opt)
450
- }};
451
- }
452
- if let Some(rslt) = else_opt {
453
- make_if!(Some(self.lower_expr(rslt)))
454
- } else {
455
- make_if!(None)
456
+ let cond = self.lower_expr(cond);
+ let then = self.arena.alloc(self.lower_block_expr(then));
+ let els = else_opt.map(|els| self.lower_expr(els));
+ hir::ExprKind::If(cond, then, els)
457
}
458
459
fn lower_expr_if_let(
0 commit comments