Skip to content

Commit 3548b8c

Browse files
committed
Auto merge of #31524 - jonas-schievink:autoderef, r=steveklabnik
2 parents ce4b75f + 559fca0 commit 3548b8c

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

94 files changed

+1206
-1208
lines changed

src/librustc/front/map/blocks.rs

+3-3
Original file line numberDiff line numberDiff line change
@@ -217,9 +217,9 @@ impl<'a> FnLikeNode<'a> {
217217
item_fn(ItemFnParts {
218218
id: i.id,
219219
name: i.name,
220-
decl: &**decl,
220+
decl: &decl,
221221
unsafety: unsafety,
222-
body: &**block,
222+
body: &block,
223223
generics: generics,
224224
abi: abi,
225225
vis: i.vis,
@@ -246,7 +246,7 @@ impl<'a> FnLikeNode<'a> {
246246
}
247247
map::NodeExpr(e) => match e.node {
248248
ast::ExprClosure(_, ref decl, ref block) =>
249-
closure(ClosureParts::new(&**decl, &**block, e.id, e.span)),
249+
closure(ClosureParts::new(&decl, &block, e.id, e.span)),
250250
_ => panic!("expr FnLikeNode that is not fn-like"),
251251
},
252252
_ => panic!("other FnLikeNode that is not fn-like"),

src/librustc/front/map/mod.rs

+15-15
Original file line numberDiff line numberDiff line change
@@ -795,7 +795,7 @@ impl<'a, 'ast> NodesMatchingSuffix<'a, 'ast> {
795795
loop {
796796
match map.find(id) {
797797
None => return None,
798-
Some(NodeItem(item)) if item_is_mod(&*item) =>
798+
Some(NodeItem(item)) if item_is_mod(&item) =>
799799
return Some((id, item.name)),
800800
_ => {}
801801
}
@@ -967,16 +967,16 @@ pub trait NodePrinter {
967967
impl<'a> NodePrinter for pprust::State<'a> {
968968
fn print_node(&mut self, node: &Node) -> io::Result<()> {
969969
match *node {
970-
NodeItem(a) => self.print_item(&*a),
971-
NodeForeignItem(a) => self.print_foreign_item(&*a),
970+
NodeItem(a) => self.print_item(&a),
971+
NodeForeignItem(a) => self.print_foreign_item(&a),
972972
NodeTraitItem(a) => self.print_trait_item(a),
973973
NodeImplItem(a) => self.print_impl_item(a),
974-
NodeVariant(a) => self.print_variant(&*a),
975-
NodeExpr(a) => self.print_expr(&*a),
976-
NodeStmt(a) => self.print_stmt(&*a),
977-
NodePat(a) => self.print_pat(&*a),
978-
NodeBlock(a) => self.print_block(&*a),
979-
NodeLifetime(a) => self.print_lifetime(&*a),
974+
NodeVariant(a) => self.print_variant(&a),
975+
NodeExpr(a) => self.print_expr(&a),
976+
NodeStmt(a) => self.print_stmt(&a),
977+
NodePat(a) => self.print_pat(&a),
978+
NodeBlock(a) => self.print_block(&a),
979+
NodeLifetime(a) => self.print_lifetime(&a),
980980
NodeTyParam(_) => panic!("cannot print TyParam"),
981981
// these cases do not carry enough information in the
982982
// ast_map to reconstruct their full structure for pretty
@@ -1055,26 +1055,26 @@ fn node_id_to_string(map: &Map, id: NodeId, include_id: bool) -> String {
10551055
map.path_to_string(id), id_str)
10561056
}
10571057
Some(NodeExpr(ref expr)) => {
1058-
format!("expr {}{}", pprust::expr_to_string(&**expr), id_str)
1058+
format!("expr {}{}", pprust::expr_to_string(&expr), id_str)
10591059
}
10601060
Some(NodeStmt(ref stmt)) => {
1061-
format!("stmt {}{}", pprust::stmt_to_string(&**stmt), id_str)
1061+
format!("stmt {}{}", pprust::stmt_to_string(&stmt), id_str)
10621062
}
10631063
Some(NodeLocal(ref pat)) => {
1064-
format!("local {}{}", pprust::pat_to_string(&**pat), id_str)
1064+
format!("local {}{}", pprust::pat_to_string(&pat), id_str)
10651065
}
10661066
Some(NodePat(ref pat)) => {
1067-
format!("pat {}{}", pprust::pat_to_string(&**pat), id_str)
1067+
format!("pat {}{}", pprust::pat_to_string(&pat), id_str)
10681068
}
10691069
Some(NodeBlock(ref block)) => {
1070-
format!("block {}{}", pprust::block_to_string(&**block), id_str)
1070+
format!("block {}{}", pprust::block_to_string(&block), id_str)
10711071
}
10721072
Some(NodeStructCtor(_)) => {
10731073
format!("struct_ctor {}{}", map.path_to_string(id), id_str)
10741074
}
10751075
Some(NodeLifetime(ref l)) => {
10761076
format!("lifetime {}{}",
1077-
pprust::lifetime_to_string(&**l), id_str)
1077+
pprust::lifetime_to_string(&l), id_str)
10781078
}
10791079
Some(NodeTyParam(ref ty_param)) => {
10801080
format!("typaram {:?}{}", ty_param, id_str)

src/librustc/middle/cfg/construct.rs

+24-24
Original file line numberDiff line numberDiff line change
@@ -73,12 +73,12 @@ impl<'a, 'tcx> CFGBuilder<'a, 'tcx> {
7373
fn stmt(&mut self, stmt: &hir::Stmt, pred: CFGIndex) -> CFGIndex {
7474
match stmt.node {
7575
hir::StmtDecl(ref decl, id) => {
76-
let exit = self.decl(&**decl, pred);
76+
let exit = self.decl(&decl, pred);
7777
self.add_ast_node(id, &[exit])
7878
}
7979

8080
hir::StmtExpr(ref expr, id) | hir::StmtSemi(ref expr, id) => {
81-
let exit = self.expr(&**expr, pred);
81+
let exit = self.expr(&expr, pred);
8282
self.add_ast_node(id, &[exit])
8383
}
8484
}
@@ -88,7 +88,7 @@ impl<'a, 'tcx> CFGBuilder<'a, 'tcx> {
8888
match decl.node {
8989
hir::DeclLocal(ref local) => {
9090
let init_exit = self.opt_expr(&local.init, pred);
91-
self.pat(&*local.pat, init_exit)
91+
self.pat(&local.pat, init_exit)
9292
}
9393

9494
hir::DeclItem(_) => {
@@ -111,7 +111,7 @@ impl<'a, 'tcx> CFGBuilder<'a, 'tcx> {
111111
hir::PatBox(ref subpat) |
112112
hir::PatRegion(ref subpat, _) |
113113
hir::PatIdent(_, _, Some(ref subpat)) => {
114-
let subpat_exit = self.pat(&**subpat, pred);
114+
let subpat_exit = self.pat(&subpat, pred);
115115
self.add_ast_node(pat.id, &[subpat_exit])
116116
}
117117

@@ -140,13 +140,13 @@ impl<'a, 'tcx> CFGBuilder<'a, 'tcx> {
140140
pats: I,
141141
pred: CFGIndex) -> CFGIndex {
142142
//! Handles case where all of the patterns must match.
143-
pats.fold(pred, |pred, pat| self.pat(&**pat, pred))
143+
pats.fold(pred, |pred, pat| self.pat(&pat, pred))
144144
}
145145

146146
fn expr(&mut self, expr: &hir::Expr, pred: CFGIndex) -> CFGIndex {
147147
match expr.node {
148148
hir::ExprBlock(ref blk) => {
149-
let blk_exit = self.block(&**blk, pred);
149+
let blk_exit = self.block(&blk, pred);
150150
self.add_ast_node(expr.id, &[blk_exit])
151151
}
152152

@@ -165,8 +165,8 @@ impl<'a, 'tcx> CFGBuilder<'a, 'tcx> {
165165
// v 3 v 4
166166
// [..expr..]
167167
//
168-
let cond_exit = self.expr(&**cond, pred); // 1
169-
let then_exit = self.block(&**then, cond_exit); // 2
168+
let cond_exit = self.expr(&cond, pred); // 1
169+
let then_exit = self.block(&then, cond_exit); // 2
170170
self.add_ast_node(expr.id, &[cond_exit, then_exit]) // 3,4
171171
}
172172

@@ -185,9 +185,9 @@ impl<'a, 'tcx> CFGBuilder<'a, 'tcx> {
185185
// v 4 v 5
186186
// [..expr..]
187187
//
188-
let cond_exit = self.expr(&**cond, pred); // 1
189-
let then_exit = self.block(&**then, cond_exit); // 2
190-
let else_exit = self.expr(&**otherwise, cond_exit); // 3
188+
let cond_exit = self.expr(&cond, pred); // 1
189+
let then_exit = self.block(&then, cond_exit); // 2
190+
let else_exit = self.expr(&otherwise, cond_exit); // 3
191191
self.add_ast_node(expr.id, &[then_exit, else_exit]) // 4, 5
192192
}
193193

@@ -211,14 +211,14 @@ impl<'a, 'tcx> CFGBuilder<'a, 'tcx> {
211211

212212
// Is the condition considered part of the loop?
213213
let loopback = self.add_dummy_node(&[pred]); // 1
214-
let cond_exit = self.expr(&**cond, loopback); // 2
214+
let cond_exit = self.expr(&cond, loopback); // 2
215215
let expr_exit = self.add_ast_node(expr.id, &[cond_exit]); // 3
216216
self.loop_scopes.push(LoopScope {
217217
loop_id: expr.id,
218218
continue_index: loopback,
219219
break_index: expr_exit
220220
});
221-
let body_exit = self.block(&**body, cond_exit); // 4
221+
let body_exit = self.block(&body, cond_exit); // 4
222222
self.add_contained_edge(body_exit, loopback); // 5
223223
self.loop_scopes.pop();
224224
expr_exit
@@ -246,7 +246,7 @@ impl<'a, 'tcx> CFGBuilder<'a, 'tcx> {
246246
continue_index: loopback,
247247
break_index: expr_exit,
248248
});
249-
let body_exit = self.block(&**body, loopback); // 3
249+
let body_exit = self.block(&body, loopback); // 3
250250
self.add_contained_edge(body_exit, loopback); // 4
251251
self.loop_scopes.pop();
252252
expr_exit
@@ -271,8 +271,8 @@ impl<'a, 'tcx> CFGBuilder<'a, 'tcx> {
271271
// v 3 v 4
272272
// [..exit..]
273273
//
274-
let l_exit = self.expr(&**l, pred); // 1
275-
let r_exit = self.expr(&**r, l_exit); // 2
274+
let l_exit = self.expr(&l, pred); // 1
275+
let r_exit = self.expr(&r, l_exit); // 2
276276
self.add_ast_node(expr.id, &[l_exit, r_exit]) // 3,4
277277
}
278278

@@ -304,16 +304,16 @@ impl<'a, 'tcx> CFGBuilder<'a, 'tcx> {
304304
}
305305

306306
hir::ExprCall(ref func, ref args) => {
307-
self.call(expr, pred, &**func, args.iter().map(|e| &**e))
307+
self.call(expr, pred, &func, args.iter().map(|e| &**e))
308308
}
309309

310310
hir::ExprMethodCall(_, _, ref args) => {
311-
self.call(expr, pred, &*args[0], args[1..].iter().map(|e| &**e))
311+
self.call(expr, pred, &args[0], args[1..].iter().map(|e| &**e))
312312
}
313313

314314
hir::ExprIndex(ref l, ref r) |
315315
hir::ExprBinary(_, ref l, ref r) if self.tcx.is_method_call(expr.id) => {
316-
self.call(expr, pred, &**l, Some(&**r).into_iter())
316+
self.call(expr, pred, &l, Some(&**r).into_iter())
317317
}
318318

319319
hir::ExprRange(ref start, ref end) => {
@@ -323,7 +323,7 @@ impl<'a, 'tcx> CFGBuilder<'a, 'tcx> {
323323
}
324324

325325
hir::ExprUnary(_, ref e) if self.tcx.is_method_call(expr.id) => {
326-
self.call(expr, pred, &**e, None::<hir::Expr>.iter())
326+
self.call(expr, pred, &e, None::<hir::Expr>.iter())
327327
}
328328

329329
hir::ExprTup(ref exprs) => {
@@ -413,7 +413,7 @@ impl<'a, 'tcx> CFGBuilder<'a, 'tcx> {
413413
opt_expr: &Option<P<hir::Expr>>,
414414
pred: CFGIndex) -> CFGIndex {
415415
//! Constructs graph for `opt_expr` evaluated, if Some
416-
opt_expr.iter().fold(pred, |p, e| self.expr(&**e, p))
416+
opt_expr.iter().fold(pred, |p, e| self.expr(&e, p))
417417
}
418418

419419
fn straightline<'b, I: Iterator<Item=&'b hir::Expr>>(&mut self,
@@ -461,18 +461,18 @@ impl<'a, 'tcx> CFGBuilder<'a, 'tcx> {
461461

462462
for pat in &arm.pats {
463463
// Visit the pattern, coming from the discriminant exit
464-
let mut pat_exit = self.pat(&**pat, discr_exit);
464+
let mut pat_exit = self.pat(&pat, discr_exit);
465465

466466
// If there is a guard expression, handle it here
467467
if let Some(ref guard) = arm.guard {
468468
// Add a dummy node for the previous guard
469469
// expression to target
470470
let guard_start = self.add_dummy_node(&[pat_exit]);
471471
// Visit the guard expression
472-
let guard_exit = self.expr(&**guard, guard_start);
472+
let guard_exit = self.expr(&guard, guard_start);
473473

474474
let this_has_bindings = pat_util::pat_contains_bindings_or_wild(
475-
&self.tcx.def_map.borrow(), &**pat);
475+
&self.tcx.def_map.borrow(), &pat);
476476

477477
// If both this pattern and the previous pattern
478478
// were free of bindings, they must consist only

0 commit comments

Comments
 (0)