From 02cd72e34b36d7bf2e27b9eaedf2af4e19cc2d85 Mon Sep 17 00:00:00 2001 From: Cameron Steffen Date: Sun, 1 Aug 2021 17:44:31 -0500 Subject: [PATCH] Inline make_if macro --- compiler/rustc_ast_lowering/src/expr.rs | 16 ++++------------ 1 file changed, 4 insertions(+), 12 deletions(-) diff --git a/compiler/rustc_ast_lowering/src/expr.rs b/compiler/rustc_ast_lowering/src/expr.rs index 7fecf537cfb..bacf5662bc0 100644 --- a/compiler/rustc_ast_lowering/src/expr.rs +++ b/compiler/rustc_ast_lowering/src/expr.rs @@ -442,18 +442,10 @@ fn lower_expr_if( then: &Block, else_opt: Option<&Expr>, ) -> hir::ExprKind<'hir> { - macro_rules! make_if { - ($opt:expr) => {{ - let cond = self.lower_expr(cond); - let then_expr = self.lower_block_expr(then); - hir::ExprKind::If(cond, self.arena.alloc(then_expr), $opt) - }}; - } - if let Some(rslt) = else_opt { - make_if!(Some(self.lower_expr(rslt))) - } else { - make_if!(None) - } + 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) } fn lower_expr_if_let(