diff options
| author | bors <bors@rust-lang.org> | 2021-08-02 15:54:11 +0000 |
|---|---|---|
| committer | bors <bors@rust-lang.org> | 2021-08-02 15:54:11 +0000 |
| commit | 6be8a06bcf2e7c45db2f9e3dd3c9c0e282562a93 (patch) | |
| tree | 5b4d80eede168926e22d9f1aa206ceb983e2e011 /compiler/rustc_ast_lowering/src | |
| parent | 3227e35765bab6d02c581928e26ad1d34bacf394 (diff) | |
| parent | 7fc26e96657f39de592d7667eac3b0df39642a66 (diff) | |
Auto merge of #87698 - camsteffen:rollup-yvjfc26, r=camsteffen
Rollup of 6 pull requests Successful merges: - #86176 (Implement a `explicit_generic_args_with_impl_trait` feature gate) - #87654 (Add documentation for the order of Option and Result) - #87659 (Fix invalid suggestions for non-ASCII characters in byte constants) - #87673 (Tweak opaque type mismatch error) - #87687 (Inline some macros) - #87690 (Add missing "allocated object" doc link to `<*mut T>::add`) Failed merges: r? `@ghost` `@rustbot` modify labels: rollup
Diffstat (limited to 'compiler/rustc_ast_lowering/src')
| -rw-r--r-- | compiler/rustc_ast_lowering/src/expr.rs | 16 |
1 files 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 @@ impl<'hir> LoweringContext<'_, 'hir> { 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( |
