Skip to content

Commit 75632c5

Browse files
committed
Remove some type information.
1 parent 1984ec5 commit 75632c5

File tree

3 files changed

+13
-15
lines changed

3 files changed

+13
-15
lines changed

src/librustc/hir/lowering.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -2041,8 +2041,8 @@ impl<'a, 'hir> LoweringContext<'a, 'hir> {
20412041
},
20422042
)
20432043
});
2044-
let ty = ty.map(|ty| -> &'hir hir::Ty { self.arena.alloc(ty.into_inner()) });
2045-
let init = l.init.as_ref().map(|e| -> &'hir hir::Expr<'hir> { self.lower_expr(e) });
2044+
let ty = ty.map(|ty| &*self.arena.alloc(ty.into_inner()));
2045+
let init = l.init.as_ref().map(|e| self.lower_expr(e));
20462046
(
20472047
hir::Local {
20482048
hir_id: self.lower_node_id(l.id),

src/librustc/hir/lowering/expr.rs

+7-11
Original file line numberDiff line numberDiff line change
@@ -157,21 +157,19 @@ impl<'hir> LoweringContext<'_, 'hir> {
157157
hir::ExprKind::Path(qpath)
158158
}
159159
ExprKind::Break(opt_label, ref opt_expr) => {
160-
let opt_expr =
161-
opt_expr.as_ref().map(|x| -> &'hir hir::Expr<'hir> { self.lower_expr(x) });
160+
let opt_expr = opt_expr.as_ref().map(|x| self.lower_expr(x));
162161
hir::ExprKind::Break(self.lower_jump_destination(e.id, opt_label), opt_expr)
163162
}
164163
ExprKind::Continue(opt_label) => {
165164
hir::ExprKind::Continue(self.lower_jump_destination(e.id, opt_label))
166165
}
167166
ExprKind::Ret(ref e) => {
168-
let e = e.as_ref().map(|x| -> &'hir hir::Expr<'hir> { self.lower_expr(x) });
167+
let e = e.as_ref().map(|x| self.lower_expr(x));
169168
hir::ExprKind::Ret(e)
170169
}
171170
ExprKind::InlineAsm(ref asm) => self.lower_expr_asm(asm),
172171
ExprKind::Struct(ref path, ref fields, ref maybe_expr) => {
173-
let maybe_expr =
174-
maybe_expr.as_ref().map(|x| -> &'hir hir::Expr<'hir> { self.lower_expr(x) });
172+
let maybe_expr = maybe_expr.as_ref().map(|x| self.lower_expr(x));
175173
hir::ExprKind::Struct(
176174
self.arena.alloc(self.lower_qpath(
177175
e.id,
@@ -431,12 +429,10 @@ impl<'hir> LoweringContext<'_, 'hir> {
431429
);
432430

433431
// Final expression of the block (if present) or `()` with span at the end of block
434-
let tail_expr = block.expr.take().map_or_else(
435-
|| -> &'hir hir::Expr<'hir> {
436-
this.expr_unit(this.sess.source_map().end_point(try_span))
437-
},
438-
|x: &'hir hir::Expr<'hir>| x,
439-
);
432+
let tail_expr = block
433+
.expr
434+
.take()
435+
.unwrap_or_else(|| this.expr_unit(this.sess.source_map().end_point(try_span)));
440436

441437
let ok_wrapped_span =
442438
this.mark_span_with_reason(DesugaringKind::TryBlock, tail_expr.span, None);

src/librustc/hir/lowering/item.rs

+4-2
Original file line numberDiff line numberDiff line change
@@ -797,8 +797,10 @@ impl<'hir> LoweringContext<'_, 'hir> {
797797
(generics, hir::TraitItemKind::Method(sig, hir::TraitMethod::Provided(body_id)))
798798
}
799799
AssocItemKind::TyAlias(ref bounds, ref default) => {
800-
let ty = default.as_ref().map(|x| -> &'hir hir::Ty {
801-
self.arena.alloc(self.lower_ty(x, ImplTraitContext::disallowed()).into_inner())
800+
let ty = default.as_ref().map(|x| {
801+
&*self
802+
.arena
803+
.alloc(self.lower_ty(x, ImplTraitContext::disallowed()).into_inner())
802804
});
803805
let generics = self.lower_generics(&i.generics, ImplTraitContext::disallowed());
804806
let kind = hir::TraitItemKind::Type(

0 commit comments

Comments
 (0)