Skip to content

Commit 02cd72e

Browse files
committed
Inline make_if macro
1 parent 8746b79 commit 02cd72e

File tree

1 file changed

+4
-12
lines changed
  • compiler/rustc_ast_lowering/src

1 file changed

+4
-12
lines changed

compiler/rustc_ast_lowering/src/expr.rs

+4-12
Original file line numberDiff line numberDiff line change
@@ -442,18 +442,10 @@ impl<'hir> LoweringContext<'_, 'hir> {
442442
then: &Block,
443443
else_opt: Option<&Expr>,
444444
) -> 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-
}
445+
let cond = self.lower_expr(cond);
446+
let then = self.arena.alloc(self.lower_block_expr(then));
447+
let els = else_opt.map(|els| self.lower_expr(els));
448+
hir::ExprKind::If(cond, then, els)
457449
}
458450

459451
fn lower_expr_if_let(

0 commit comments

Comments
 (0)