Skip to content

Commit 003879c

Browse files
Autoderef in librustc_passes
1 parent d12adae commit 003879c

File tree

2 files changed

+19
-19
lines changed

2 files changed

+19
-19
lines changed

src/librustc_passes/consts.rs

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -266,20 +266,20 @@ impl<'a, 'tcx, 'v> Visitor<'v> for CheckCrateVisitor<'a, 'tcx> {
266266
assert_eq!(self.mode, Mode::Var);
267267
match i.node {
268268
hir::ItemStatic(_, hir::MutImmutable, ref expr) => {
269-
self.check_static_type(&**expr);
270-
self.global_expr(Mode::Static, &**expr);
269+
self.check_static_type(&expr);
270+
self.global_expr(Mode::Static, &expr);
271271
}
272272
hir::ItemStatic(_, hir::MutMutable, ref expr) => {
273-
self.check_static_mut_type(&**expr);
274-
self.global_expr(Mode::StaticMut, &**expr);
273+
self.check_static_mut_type(&expr);
274+
self.global_expr(Mode::StaticMut, &expr);
275275
}
276276
hir::ItemConst(_, ref expr) => {
277-
self.global_expr(Mode::Const, &**expr);
277+
self.global_expr(Mode::Const, &expr);
278278
}
279279
hir::ItemEnum(ref enum_definition, _) => {
280280
for var in &enum_definition.variants {
281281
if let Some(ref ex) = var.node.disr_expr {
282-
self.global_expr(Mode::Const, &**ex);
282+
self.global_expr(Mode::Const, &ex);
283283
}
284284
}
285285
}
@@ -293,7 +293,7 @@ impl<'a, 'tcx, 'v> Visitor<'v> for CheckCrateVisitor<'a, 'tcx> {
293293
match t.node {
294294
hir::ConstTraitItem(_, ref default) => {
295295
if let Some(ref expr) = *default {
296-
self.global_expr(Mode::Const, &*expr);
296+
self.global_expr(Mode::Const, &expr);
297297
} else {
298298
intravisit::walk_trait_item(self, t);
299299
}
@@ -305,7 +305,7 @@ impl<'a, 'tcx, 'v> Visitor<'v> for CheckCrateVisitor<'a, 'tcx> {
305305
fn visit_impl_item(&mut self, i: &'v hir::ImplItem) {
306306
match i.node {
307307
hir::ImplItemKind::Const(_, ref expr) => {
308-
self.global_expr(Mode::Const, &*expr);
308+
self.global_expr(Mode::Const, &expr);
309309
}
310310
_ => self.with_mode(Mode::Var, |v| intravisit::walk_impl_item(v, i)),
311311
}
@@ -323,11 +323,11 @@ impl<'a, 'tcx, 'v> Visitor<'v> for CheckCrateVisitor<'a, 'tcx> {
323323
fn visit_pat(&mut self, p: &hir::Pat) {
324324
match p.node {
325325
hir::PatLit(ref lit) => {
326-
self.global_expr(Mode::Const, &**lit);
326+
self.global_expr(Mode::Const, &lit);
327327
}
328328
hir::PatRange(ref start, ref end) => {
329-
self.global_expr(Mode::Const, &**start);
330-
self.global_expr(Mode::Const, &**end);
329+
self.global_expr(Mode::Const, &start);
330+
self.global_expr(Mode::Const, &end);
331331

332332
match const_eval::compare_lit_exprs(self.tcx, start, end) {
333333
Some(Ordering::Less) |
@@ -379,17 +379,17 @@ impl<'a, 'tcx, 'v> Visitor<'v> for CheckCrateVisitor<'a, 'tcx> {
379379
match ex.node {
380380
hir::ExprCall(ref callee, ref args) => {
381381
for arg in args {
382-
self.visit_expr(&**arg)
382+
self.visit_expr(&arg)
383383
}
384384

385385
let inner = self.qualif;
386-
self.visit_expr(&**callee);
386+
self.visit_expr(&callee);
387387
// The callee's size doesn't count in the call.
388388
let added = self.qualif - inner;
389389
self.qualif = inner | (added - ConstQualif::NON_ZERO_SIZED);
390390
}
391391
hir::ExprRepeat(ref element, _) => {
392-
self.visit_expr(&**element);
392+
self.visit_expr(&element);
393393
// The count is checked elsewhere (typeck).
394394
let count = match node_ty.sty {
395395
ty::TyArray(_, n) => n,
@@ -631,7 +631,7 @@ fn check_expr<'a, 'tcx>(v: &mut CheckCrateVisitor<'a, 'tcx>,
631631
loop {
632632
callee = match callee.node {
633633
hir::ExprBlock(ref block) => match block.expr {
634-
Some(ref tail) => &**tail,
634+
Some(ref tail) => &tail,
635635
None => break
636636
},
637637
_ => break

src/librustc_passes/loops.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -42,14 +42,14 @@ impl<'a, 'v> Visitor<'v> for CheckLoopVisitor<'a> {
4242
fn visit_expr(&mut self, e: &hir::Expr) {
4343
match e.node {
4444
hir::ExprWhile(ref e, ref b, _) => {
45-
self.visit_expr(&**e);
46-
self.with_context(Loop, |v| v.visit_block(&**b));
45+
self.visit_expr(&e);
46+
self.with_context(Loop, |v| v.visit_block(&b));
4747
}
4848
hir::ExprLoop(ref b, _) => {
49-
self.with_context(Loop, |v| v.visit_block(&**b));
49+
self.with_context(Loop, |v| v.visit_block(&b));
5050
}
5151
hir::ExprClosure(_, _, ref b) => {
52-
self.with_context(Closure, |v| v.visit_block(&**b));
52+
self.with_context(Closure, |v| v.visit_block(&b));
5353
}
5454
hir::ExprBreak(_) => self.require_loop("break", e.span),
5555
hir::ExprAgain(_) => self.require_loop("continue", e.span),

0 commit comments

Comments
 (0)