about summary refs log tree commit diff
diff options
context:
space:
mode:
-rw-r--r--src/librustc/hir/lowering.rs4
-rw-r--r--src/librustc/hir/lowering/expr.rs18
-rw-r--r--src/librustc/hir/lowering/item.rs6
3 files changed, 13 insertions, 15 deletions
diff --git a/src/librustc/hir/lowering.rs b/src/librustc/hir/lowering.rs
index c6e2cf4cc9c..432d550a240 100644
--- a/src/librustc/hir/lowering.rs
+++ b/src/librustc/hir/lowering.rs
@@ -2041,8 +2041,8 @@ impl<'a, 'hir> LoweringContext<'a, 'hir> {
                 },
             )
         });
-        let ty = ty.map(|ty| -> &'hir hir::Ty { self.arena.alloc(ty.into_inner()) });
-        let init = l.init.as_ref().map(|e| -> &'hir hir::Expr<'hir> { self.lower_expr(e) });
+        let ty = ty.map(|ty| &*self.arena.alloc(ty.into_inner()));
+        let init = l.init.as_ref().map(|e| self.lower_expr(e));
         (
             hir::Local {
                 hir_id: self.lower_node_id(l.id),
diff --git a/src/librustc/hir/lowering/expr.rs b/src/librustc/hir/lowering/expr.rs
index 8061cf43281..8a9614c6cb2 100644
--- a/src/librustc/hir/lowering/expr.rs
+++ b/src/librustc/hir/lowering/expr.rs
@@ -157,21 +157,19 @@ impl<'hir> LoweringContext<'_, 'hir> {
                 hir::ExprKind::Path(qpath)
             }
             ExprKind::Break(opt_label, ref opt_expr) => {
-                let opt_expr =
-                    opt_expr.as_ref().map(|x| -> &'hir hir::Expr<'hir> { self.lower_expr(x) });
+                let opt_expr = opt_expr.as_ref().map(|x| self.lower_expr(x));
                 hir::ExprKind::Break(self.lower_jump_destination(e.id, opt_label), opt_expr)
             }
             ExprKind::Continue(opt_label) => {
                 hir::ExprKind::Continue(self.lower_jump_destination(e.id, opt_label))
             }
             ExprKind::Ret(ref e) => {
-                let e = e.as_ref().map(|x| -> &'hir hir::Expr<'hir> { self.lower_expr(x) });
+                let e = e.as_ref().map(|x| self.lower_expr(x));
                 hir::ExprKind::Ret(e)
             }
             ExprKind::InlineAsm(ref asm) => self.lower_expr_asm(asm),
             ExprKind::Struct(ref path, ref fields, ref maybe_expr) => {
-                let maybe_expr =
-                    maybe_expr.as_ref().map(|x| -> &'hir hir::Expr<'hir> { self.lower_expr(x) });
+                let maybe_expr = maybe_expr.as_ref().map(|x| self.lower_expr(x));
                 hir::ExprKind::Struct(
                     self.arena.alloc(self.lower_qpath(
                         e.id,
@@ -431,12 +429,10 @@ impl<'hir> LoweringContext<'_, 'hir> {
             );
 
             // Final expression of the block (if present) or `()` with span at the end of block
-            let tail_expr = block.expr.take().map_or_else(
-                || -> &'hir hir::Expr<'hir> {
-                    this.expr_unit(this.sess.source_map().end_point(try_span))
-                },
-                |x: &'hir hir::Expr<'hir>| x,
-            );
+            let tail_expr = block
+                .expr
+                .take()
+                .unwrap_or_else(|| this.expr_unit(this.sess.source_map().end_point(try_span)));
 
             let ok_wrapped_span =
                 this.mark_span_with_reason(DesugaringKind::TryBlock, tail_expr.span, None);
diff --git a/src/librustc/hir/lowering/item.rs b/src/librustc/hir/lowering/item.rs
index ff7a67fb0ba..0157e89c96b 100644
--- a/src/librustc/hir/lowering/item.rs
+++ b/src/librustc/hir/lowering/item.rs
@@ -797,8 +797,10 @@ impl<'hir> LoweringContext<'_, 'hir> {
                 (generics, hir::TraitItemKind::Method(sig, hir::TraitMethod::Provided(body_id)))
             }
             AssocItemKind::TyAlias(ref bounds, ref default) => {
-                let ty = default.as_ref().map(|x| -> &'hir hir::Ty {
-                    self.arena.alloc(self.lower_ty(x, ImplTraitContext::disallowed()).into_inner())
+                let ty = default.as_ref().map(|x| {
+                    &*self
+                        .arena
+                        .alloc(self.lower_ty(x, ImplTraitContext::disallowed()).into_inner())
                 });
                 let generics = self.lower_generics(&i.generics, ImplTraitContext::disallowed());
                 let kind = hir::TraitItemKind::Type(