]> git.lizzy.rs Git - rust.git/commitdiff
Autoderef in librustc_typeck
authorJonas Schievink <jonas@schievink.net>
Tue, 9 Feb 2016 20:09:37 +0000 (21:09 +0100)
committerJonas Schievink <jonas@schievink.net>
Fri, 12 Feb 2016 18:28:42 +0000 (19:28 +0100)
src/librustc_typeck/astconv.rs
src/librustc_typeck/check/_match.rs
src/librustc_typeck/check/callee.rs
src/librustc_typeck/check/closure.rs
src/librustc_typeck/check/method/confirm.rs
src/librustc_typeck/check/method/suggest.rs
src/librustc_typeck/check/mod.rs
src/librustc_typeck/check/regionck.rs
src/librustc_typeck/check/upvar.rs
src/librustc_typeck/check/writeback.rs
src/librustc_typeck/collect.rs

index d67f5f9db5ee4f3bc70f1adae480e017aeef4c7b..4061d3a2028c77989700dd6f987ed9134304aaee 100644 (file)
@@ -562,7 +562,7 @@ fn convert_angle_bracketed_parameters<'tcx>(this: &AstConv<'tcx>,
     let assoc_bindings: Vec<_> =
         data.bindings.iter()
                      .map(|b| ConvertedBinding { item_name: b.name,
-                                                 ty: ast_ty_to_ty(this, rscope, &*b.ty),
+                                                 ty: ast_ty_to_ty(this, rscope, &b.ty),
                                                  span: b.span })
                      .collect();
 
@@ -1064,7 +1064,7 @@ fn ast_ty_to_trait_ref<'tcx>(this: &AstConv<'tcx>,
                     err.span_suggestion(full_span, "try adding parentheses (per RFC 438):",
                                         format!("&{}({} +{})",
                                                 mutbl_str,
-                                                pprust::ty_to_string(&*mut_ty.ty),
+                                                pprust::ty_to_string(&mut_ty.ty),
                                                 pprust::bounds_to_string(bounds)));
                 }
                 (&hir::TyRptr(Some(ref lt), ref mut_ty), Some(full_span)) => {
@@ -1073,7 +1073,7 @@ fn ast_ty_to_trait_ref<'tcx>(this: &AstConv<'tcx>,
                                         format!("&{} {}({} +{})",
                                                 pprust::lifetime_to_string(lt),
                                                 mutbl_str,
-                                                pprust::ty_to_string(&*mut_ty.ty),
+                                                pprust::ty_to_string(&mut_ty.ty),
                                                 pprust::bounds_to_string(bounds)));
                 }
 
@@ -1596,10 +1596,10 @@ pub fn ast_ty_to_ty<'tcx>(this: &AstConv<'tcx>,
 
     let typ = match ast_ty.node {
         hir::TyVec(ref ty) => {
-            tcx.mk_slice(ast_ty_to_ty(this, rscope, &**ty))
+            tcx.mk_slice(ast_ty_to_ty(this, rscope, &ty))
         }
         hir::TyObjectSum(ref ty, ref bounds) => {
-            match ast_ty_to_trait_ref(this, rscope, &**ty, bounds) {
+            match ast_ty_to_trait_ref(this, rscope, &ty, bounds) {
                 Ok((trait_ref, projection_bounds)) => {
                     trait_ref_to_object_type(this,
                                              rscope,
@@ -1615,7 +1615,7 @@ pub fn ast_ty_to_ty<'tcx>(this: &AstConv<'tcx>,
         }
         hir::TyPtr(ref mt) => {
             tcx.mk_ptr(ty::TypeAndMut {
-                ty: ast_ty_to_ty(this, rscope, &*mt.ty),
+                ty: ast_ty_to_ty(this, rscope, &mt.ty),
                 mutbl: mt.mutbl
             })
         }
@@ -1626,18 +1626,18 @@ pub fn ast_ty_to_ty<'tcx>(this: &AstConv<'tcx>,
                 &ObjectLifetimeDefaultRscope::new(
                     rscope,
                     ty::ObjectLifetimeDefault::Specific(r));
-            let t = ast_ty_to_ty(this, rscope1, &*mt.ty);
+            let t = ast_ty_to_ty(this, rscope1, &mt.ty);
             tcx.mk_ref(tcx.mk_region(r), ty::TypeAndMut {ty: t, mutbl: mt.mutbl})
         }
         hir::TyTup(ref fields) => {
             let flds = fields.iter()
-                             .map(|t| ast_ty_to_ty(this, rscope, &**t))
+                             .map(|t| ast_ty_to_ty(this, rscope, &t))
                              .collect();
             tcx.mk_tup(flds)
         }
         hir::TyBareFn(ref bf) => {
             require_c_abi_if_variadic(tcx, &bf.decl, bf.abi, ast_ty.span);
-            let bare_fn = ty_of_bare_fn(this, bf.unsafety, bf.abi, &*bf.decl);
+            let bare_fn = ty_of_bare_fn(this, bf.unsafety, bf.abi, &bf.decl);
             tcx.mk_fn(None, tcx.mk_bare_fn(bare_fn))
         }
         hir::TyPolyTraitRef(ref bounds) => {
@@ -1687,10 +1687,10 @@ pub fn ast_ty_to_ty<'tcx>(this: &AstConv<'tcx>,
                 Ok(r) => {
                     match r {
                         ConstVal::Int(i) =>
-                            tcx.mk_array(ast_ty_to_ty(this, rscope, &**ty),
+                            tcx.mk_array(ast_ty_to_ty(this, rscope, &ty),
                                          i as usize),
                         ConstVal::Uint(i) =>
-                            tcx.mk_array(ast_ty_to_ty(this, rscope, &**ty),
+                            tcx.mk_array(ast_ty_to_ty(this, rscope, &ty),
                                          i as usize),
                         _ => {
                             span_err!(tcx.sess, ast_ty.span, E0249,
@@ -1740,7 +1740,7 @@ pub fn ty_of_arg<'tcx>(this: &AstConv<'tcx>,
     match a.ty.node {
         hir::TyInfer if expected_ty.is_some() => expected_ty.unwrap(),
         hir::TyInfer => this.ty_infer(None, None, None, a.ty.span),
-        _ => ast_ty_to_ty(this, rscope, &*a.ty),
+        _ => ast_ty_to_ty(this, rscope, &a.ty),
     }
 }
 
@@ -1804,7 +1804,7 @@ fn ty_of_method_or_bare_fn<'a, 'tcx>(this: &AstConv<'tcx>,
     let arg_tys: Vec<Ty> =
         arg_params.iter().map(|a| ty_of_arg(this, &rb, a, None)).collect();
     let arg_pats: Vec<String> =
-        arg_params.iter().map(|a| pprust::pat_to_string(&*a.pat)).collect();
+        arg_params.iter().map(|a| pprust::pat_to_string(&a.pat)).collect();
 
     // Second, if there was exactly one lifetime (either a substitution or a
     // reference) in the arguments, then any anonymous regions in the output
@@ -1860,7 +1860,7 @@ fn determine_self_type<'a, 'tcx>(this: &AstConv<'tcx>,
              Some(ty::ExplicitSelfCategory::ByReference(region, mutability)))
         }
         hir::SelfExplicit(ref ast_type, _) => {
-            let explicit_type = ast_ty_to_ty(this, rscope, &**ast_type);
+            let explicit_type = ast_ty_to_ty(this, rscope, &ast_type);
 
             // We wish to (for now) categorize an explicit self
             // declaration like `self: SomeType` into either `self`,
@@ -1967,7 +1967,7 @@ pub fn ty_of_closure<'tcx>(
         _ if is_infer =>
             ty::FnConverging(this.ty_infer(None, None, None, decl.output.span())),
         hir::Return(ref output) =>
-            ty::FnConverging(ast_ty_to_ty(this, &rb, &**output)),
+            ty::FnConverging(ast_ty_to_ty(this, &rb, &output)),
         hir::DefaultReturn(..) => unreachable!(),
         hir::NoReturn(..) => ty::FnDiverging
     };
index f0436eee420090712d2d8b400a9023a010163478..6ca48f2d8d484c9c0a42573c0a3998ed8e3aa7cb 100644 (file)
@@ -50,8 +50,8 @@ pub fn check_pat<'a, 'tcx>(pcx: &pat_ctxt<'a, 'tcx>,
             fcx.write_ty(pat.id, expected);
         }
         hir::PatLit(ref lt) => {
-            check_expr(fcx, &**lt);
-            let expr_ty = fcx.expr_ty(&**lt);
+            check_expr(fcx, &lt);
+            let expr_ty = fcx.expr_ty(&lt);
 
             // Byte string patterns behave the same way as array patterns
             // They can denote both statically and dynamically sized byte arrays
@@ -198,7 +198,7 @@ pub fn check_pat<'a, 'tcx>(pcx: &pat_ctxt<'a, 'tcx>,
                 }
 
                 if let Some(ref p) = *sub {
-                    check_pat(pcx, &**p, expected);
+                    check_pat(pcx, &p, expected);
                 }
             }
         }
@@ -259,28 +259,28 @@ pub fn check_pat<'a, 'tcx>(pcx: &pat_ctxt<'a, 'tcx>,
             fcx.write_ty(pat.id, pat_ty);
             demand::eqtype(fcx, pat.span, expected, pat_ty);
             for (element_pat, element_ty) in elements.iter().zip(element_tys) {
-                check_pat(pcx, &**element_pat, element_ty);
+                check_pat(pcx, &element_pat, element_ty);
             }
         }
         hir::PatBox(ref inner) => {
             let inner_ty = fcx.infcx().next_ty_var();
             let uniq_ty = tcx.mk_box(inner_ty);
 
-            if check_dereferencable(pcx, pat.span, expected, &**inner) {
+            if check_dereferencable(pcx, pat.span, expected, &inner) {
                 // Here, `demand::subtype` is good enough, but I don't
                 // think any errors can be introduced by using
                 // `demand::eqtype`.
                 demand::eqtype(fcx, pat.span, expected, uniq_ty);
                 fcx.write_ty(pat.id, uniq_ty);
-                check_pat(pcx, &**inner, inner_ty);
+                check_pat(pcx, &inner, inner_ty);
             } else {
                 fcx.write_error(pat.id);
-                check_pat(pcx, &**inner, tcx.types.err);
+                check_pat(pcx, &inner, tcx.types.err);
             }
         }
         hir::PatRegion(ref inner, mutbl) => {
             let expected = fcx.infcx().shallow_resolve(expected);
-            if check_dereferencable(pcx, pat.span, expected, &**inner) {
+            if check_dereferencable(pcx, pat.span, expected, &inner) {
                 // `demand::subtype` would be good enough, but using
                 // `eqtype` turns out to be equally general. See (*)
                 // below for details.
@@ -304,10 +304,10 @@ pub fn check_pat<'a, 'tcx>(pcx: &pat_ctxt<'a, 'tcx>,
                 };
 
                 fcx.write_ty(pat.id, rptr_ty);
-                check_pat(pcx, &**inner, inner_ty);
+                check_pat(pcx, &inner, inner_ty);
             } else {
                 fcx.write_error(pat.id);
-                check_pat(pcx, &**inner, tcx.types.err);
+                check_pat(pcx, &inner, tcx.types.err);
             }
         }
         hir::PatVec(ref before, ref slice, ref after) => {
@@ -339,7 +339,7 @@ pub fn check_pat<'a, 'tcx>(pcx: &pat_ctxt<'a, 'tcx>,
             demand::eqtype(fcx, pat.span, expected, pat_ty);
 
             for elt in before {
-                check_pat(pcx, &**elt, inner_ty);
+                check_pat(pcx, &elt, inner_ty);
             }
             if let Some(ref slice) = *slice {
                 let region = fcx.infcx().next_region_var(infer::PatternRegion(pat.span));
@@ -350,10 +350,10 @@ pub fn check_pat<'a, 'tcx>(pcx: &pat_ctxt<'a, 'tcx>,
                     ty: tcx.mk_slice(inner_ty),
                     mutbl: mutbl
                 });
-                check_pat(pcx, &**slice, slice_ty);
+                check_pat(pcx, &slice, slice_ty);
             }
             for elt in after {
-                check_pat(pcx, &**elt, inner_ty);
+                check_pat(pcx, &elt, inner_ty);
             }
         }
     }
@@ -482,10 +482,10 @@ pub fn check_match<'a, 'tcx>(fcx: &FnCtxt<'a, 'tcx>,
     for arm in arms {
         let mut pcx = pat_ctxt {
             fcx: fcx,
-            map: pat_id_map(&tcx.def_map, &*arm.pats[0]),
+            map: pat_id_map(&tcx.def_map, &arm.pats[0]),
         };
         for p in &arm.pats {
-            check_pat(&mut pcx, &**p, discrim_ty);
+            check_pat(&mut pcx, &p, discrim_ty);
         }
     }
 
@@ -507,17 +507,17 @@ pub fn check_match<'a, 'tcx>(fcx: &FnCtxt<'a, 'tcx>,
             // arm for inconsistent arms or to the whole match when a `()` type
             // is required).
             Expectation::ExpectHasType(ety) if ety != fcx.tcx().mk_nil() => {
-                check_expr_coercable_to_type(fcx, &*arm.body, ety);
+                check_expr_coercable_to_type(fcx, &arm.body, ety);
                 ety
             }
             _ => {
-                check_expr_with_expectation(fcx, &*arm.body, expected);
+                check_expr_with_expectation(fcx, &arm.body, expected);
                 fcx.node_ty(arm.body.id)
             }
         };
 
         if let Some(ref e) = arm.guard {
-            check_expr_has_type(fcx, &**e, tcx.types.bool);
+            check_expr_has_type(fcx, &e, tcx.types.bool);
         }
 
         if result_ty.references_error() || bty.references_error() {
@@ -622,7 +622,7 @@ pub fn check_pat_enum<'a, 'tcx>(pcx: &pat_ctxt<'a, 'tcx>,
 
             if let Some(subpats) = subpats {
                 for pat in subpats {
-                    check_pat(pcx, &**pat, tcx.types.err);
+                    check_pat(pcx, &pat, tcx.types.err);
                 }
             }
 
@@ -670,7 +670,7 @@ pub fn check_pat_enum<'a, 'tcx>(pcx: &pat_ctxt<'a, 'tcx>,
         fcx.write_error(pat.id);
         if let Some(subpats) = subpats {
             for pat in subpats {
-                check_pat(pcx, &**pat, tcx.types.err);
+                check_pat(pcx, &pat, tcx.types.err);
             }
         }
     };
@@ -742,7 +742,7 @@ pub fn check_pat_enum<'a, 'tcx>(pcx: &pat_ctxt<'a, 'tcx>,
     if let Some(subpats) = subpats {
         if subpats.len() == arg_tys.len() {
             for (subpat, arg_ty) in subpats.iter().zip(arg_tys) {
-                check_pat(pcx, &**subpat, arg_ty);
+                check_pat(pcx, &subpat, arg_ty);
             }
         } else if arg_tys.is_empty() {
             span_err!(tcx.sess, pat.span, E0024,
@@ -750,7 +750,7 @@ pub fn check_pat_enum<'a, 'tcx>(pcx: &pat_ctxt<'a, 'tcx>,
                       subpats.len(), if subpats.len() == 1 {""} else {"s"}, kind_name);
 
             for pat in subpats {
-                check_pat(pcx, &**pat, tcx.types.err);
+                check_pat(pcx, &pat, tcx.types.err);
             }
         } else {
             span_err!(tcx.sess, pat.span, E0023,
@@ -760,7 +760,7 @@ pub fn check_pat_enum<'a, 'tcx>(pcx: &pat_ctxt<'a, 'tcx>,
                       arg_tys.len(), if arg_tys.len() == 1 {""} else {"s"});
 
             for pat in subpats {
-                check_pat(pcx, &**pat, tcx.types.err);
+                check_pat(pcx, &pat, tcx.types.err);
             }
         }
     }
@@ -815,7 +815,7 @@ pub fn check_struct_pat_fields<'a, 'tcx>(pcx: &pat_ctxt<'a, 'tcx>,
             }
         };
 
-        check_pat(pcx, &*field.pat, field_ty);
+        check_pat(pcx, &field.pat, field_ty);
     }
 
     // Report an error if not all the fields were specified.
index 84c436c59c1d29b35b3b9137ff1a606d9db96a0d..42ea3cc2aaa7ba1d72537b25badfe7d7f90d4819 100644 (file)
@@ -199,7 +199,7 @@ fn try_overloaded_call_traits<'a,'tcx>(fcx: &FnCtxt<'a, 'tcx>,
 
         match method::lookup_in_trait_adjusted(fcx,
                                                call_expr.span,
-                                               Some(&*callee_expr),
+                                               Some(&callee_expr),
                                                method_name,
                                                trait_def_id,
                                                autoderefs,
@@ -304,12 +304,12 @@ fn confirm_deferred_closure_call<'a,'tcx>(fcx: &FnCtxt<'a,'tcx>,
                                    call_expr.span,
                                    expected,
                                    fn_sig.output.clone(),
-                                   &*fn_sig.inputs);
+                                   &fn_sig.inputs);
 
     check_argument_types(fcx,
                          call_expr.span,
-                         &*fn_sig.inputs,
-                         &*expected_arg_tys,
+                         &fn_sig.inputs,
+                         &expected_arg_tys,
                          arg_exprs,
                          fn_sig.variadic,
                          TupleArgumentsFlag::TupleArguments);
index 7fd35cf159ff91c91dd267751bca8d8edf799cdd..d3e66bde4f4c38ce66aa968b367111b39e215fa8 100644 (file)
@@ -83,7 +83,7 @@ fn check_closure<'a,'tcx>(fcx: &FnCtxt<'a,'tcx>,
              &fn_sig,
              decl,
              expr.id,
-             &*body,
+             &body,
              fcx.inh);
 
     // Tuple up the arguments and insert the resulting function type into
index 1d8f6f005cddc362610c7f7fdcaf746605c054e1..bf08989bc0a1275654c00309f058212285a38d9b 100644 (file)
@@ -269,7 +269,7 @@ fn fresh_receiver_substs(&mut self,
             probe::WhereClausePick(ref poly_trait_ref) => {
                 // Where clauses can have bound regions in them. We need to instantiate
                 // those to convert from a poly-trait-ref to a trait-ref.
-                self.replace_late_bound_regions_with_fresh_var(&*poly_trait_ref).substs.clone()
+                self.replace_late_bound_regions_with_fresh_var(&poly_trait_ref).substs.clone()
             }
         }
     }
@@ -290,7 +290,7 @@ fn extract_trait_ref<R, F>(&mut self, self_ty: Ty<'tcx>, mut closure: F) -> R wh
                                               NoPreference,
                                               |ty, _| {
             match ty.sty {
-                ty::TyTrait(ref data) => Some(closure(self, ty, &**data)),
+                ty::TyTrait(ref data) => Some(closure(self, ty, &data)),
                 _ => None,
             }
         });
@@ -478,7 +478,7 @@ fn fixup_derefs_on_method_receiver_if_necessary(&self,
                 hir::ExprField(ref expr, _) |
                 hir::ExprTupField(ref expr, _) |
                 hir::ExprIndex(ref expr, _) |
-                hir::ExprUnary(hir::UnDeref, ref expr) => exprs.push(&**expr),
+                hir::ExprUnary(hir::UnDeref, ref expr) => exprs.push(&expr),
                 _ => break,
             }
         }
@@ -570,13 +570,13 @@ fn fixup_derefs_on_method_receiver_if_necessary(&self,
                                     unsize: None
                                 }))), false)
                         };
-                        let index_expr_ty = self.fcx.expr_ty(&**index_expr);
+                        let index_expr_ty = self.fcx.expr_ty(&index_expr);
 
                         let result = check::try_index_step(
                             self.fcx,
                             ty::MethodCall::expr(expr.id),
                             expr,
-                            &**base_expr,
+                            &base_expr,
                             adjusted_base_ty,
                             autoderefs,
                             unsize,
@@ -586,7 +586,7 @@ fn fixup_derefs_on_method_receiver_if_necessary(&self,
                         if let Some((input_ty, return_ty)) = result {
                             demand::suptype(self.fcx, index_expr.span, input_ty, index_expr_ty);
 
-                            let expr_ty = self.fcx.expr_ty(&*expr);
+                            let expr_ty = self.fcx.expr_ty(&expr);
                             demand::suptype(self.fcx, expr.span, expr_ty, return_ty);
                         }
                     }
@@ -599,8 +599,8 @@ fn fixup_derefs_on_method_receiver_if_necessary(&self,
                                 self.fcx,
                                 expr.span,
                                 Some(method_call),
-                                Some(&**base_expr),
-                                self.fcx.expr_ty(&**base_expr),
+                                Some(&base_expr),
+                                self.fcx.expr_ty(&base_expr),
                                 PreferMutLvalue);
                         }
                     }
index 064259c171d91bb638192068bc2fbfd4e2a757b0..1367db16314e2f53e3cbae16406546d320b5d5af 100644 (file)
@@ -271,7 +271,7 @@ fn suggest_traits_to_import<'a, 'tcx>(fcx: &FnCtxt<'a, 'tcx>,
 
         for (i, trait_did) in candidates.iter().enumerate() {
             err.fileline_help(span,
-                              &*format!("candidate #{}: use `{}`",
+                              &format!("candidate #{}: use `{}`",
                                         i + 1,
                                         fcx.tcx().item_path_str(*trait_did)));
         }
@@ -316,7 +316,7 @@ fn suggest_traits_to_import<'a, 'tcx>(fcx: &FnCtxt<'a, 'tcx>,
 
         for (i, trait_info) in candidates.iter().enumerate() {
             err.fileline_help(span,
-                              &*format!("candidate #{}: `{}`",
+                              &format!("candidate #{}: `{}`",
                                         i + 1,
                                         fcx.tcx().item_path_str(trait_info.def_id)));
         }
index f61316f1dfe71b07db32ce8094d13fcbd2361069..e485bdd66fc9f265ca8f27fb9511eedbb480380d 100644 (file)
@@ -368,7 +368,7 @@ fn visit_item(&mut self, i: &'tcx hir::Item) {
     fn visit_ty(&mut self, t: &'tcx hir::Ty) {
         match t.node {
             hir::TyFixedLengthVec(_, ref expr) => {
-                check_const_in_type(self.ccx, &**expr, self.ccx.tcx.types.usize);
+                check_const_in_type(self.ccx, &expr, self.ccx.tcx.types.usize);
             }
             _ => {}
         }
@@ -491,7 +491,7 @@ impl<'a, 'tcx> Visitor<'tcx> for GatherLocalsVisitor<'a, 'tcx> {
     // Add explicitly-declared locals.
     fn visit_local(&mut self, local: &'tcx hir::Local) {
         let o_ty = match local.ty {
-            Some(ref ty) => Some(self.fcx.to_ty(&**ty)),
+            Some(ref ty) => Some(self.fcx.to_ty(&ty)),
             None => None
         };
         self.assign(local.span, local.id, o_ty);
@@ -533,8 +533,8 @@ fn visit_block(&mut self, b: &'tcx hir::Block) {
     fn visit_ty(&mut self, t: &'tcx hir::Ty) {
         match t.node {
             hir::TyFixedLengthVec(ref ty, ref count_expr) => {
-                self.visit_ty(&**ty);
-                check_expr_with_hint(self.fcx, &**count_expr, self.fcx.tcx().types.usize);
+                self.visit_ty(&ty);
+                check_expr_with_hint(self.fcx, &count_expr, self.fcx.tcx().types.usize);
             }
             hir::TyBareFn(ref function_declaration) => {
                 intravisit::walk_fn_decl_nopat(self, &function_declaration.decl);
@@ -612,7 +612,7 @@ fn check_fn<'a, 'tcx>(ccx: &'a CrateCtxt<'a, 'tcx>,
             // Create type variables for each argument.
             pat_util::pat_bindings(
                 &tcx.def_map,
-                &*input.pat,
+                &input.pat,
                 |_bm, pat_id, sp, _path| {
                     let var_ty = visit.assign(sp, pat_id, None);
                     fcx.require_type_is_sized(var_ty, sp,
@@ -622,9 +622,9 @@ fn check_fn<'a, 'tcx>(ccx: &'a CrateCtxt<'a, 'tcx>,
             // Check the pattern.
             let pcx = pat_ctxt {
                 fcx: &fcx,
-                map: pat_id_map(&tcx.def_map, &*input.pat),
+                map: pat_id_map(&tcx.def_map, &input.pat),
             };
-            _match::check_pat(&pcx, &*input.pat, *arg_ty);
+            _match::check_pat(&pcx, &input.pat, *arg_ty);
         }
 
         visit.visit_block(body);
@@ -660,7 +660,7 @@ pub fn check_item_type<'a,'tcx>(ccx: &CrateCtxt<'a,'tcx>, it: &'tcx hir::Item) {
     match it.node {
       // Consts can play a role in type-checking, so they are included here.
       hir::ItemStatic(_, _, ref e) |
-      hir::ItemConst(_, ref e) => check_const(ccx, it.span, &**e, it.id),
+      hir::ItemConst(_, ref e) => check_const(ccx, it.span, &e, it.id),
       hir::ItemEnum(ref enum_definition, _) => {
         check_enum_variants(ccx,
                             it.span,
@@ -730,7 +730,7 @@ pub fn check_item_body<'a,'tcx>(ccx: &CrateCtxt<'a,'tcx>, it: &'tcx hir::Item) {
       hir::ItemFn(ref decl, _, _, _, _, ref body) => {
         let fn_pty = ccx.tcx.lookup_item_type(ccx.tcx.map.local_def_id(it.id));
         let param_env = ParameterEnvironment::for_item(ccx.tcx, it.id);
-        check_bare_fn(ccx, &**decl, &**body, it.id, it.span, fn_pty.ty, param_env);
+        check_bare_fn(ccx, &decl, &body, it.id, it.span, fn_pty.ty, param_env);
       }
       hir::ItemImpl(_, _, _, _, _, ref impl_items) => {
         debug!("ItemImpl {} with id {}", it.name, it.id);
@@ -740,7 +740,7 @@ pub fn check_item_body<'a,'tcx>(ccx: &CrateCtxt<'a,'tcx>, it: &'tcx hir::Item) {
         for impl_item in impl_items {
             match impl_item.node {
                 hir::ImplItemKind::Const(_, ref expr) => {
-                    check_const(ccx, impl_item.span, &*expr, impl_item.id)
+                    check_const(ccx, impl_item.span, &expr, impl_item.id)
                 }
                 hir::ImplItemKind::Method(ref sig, ref body) => {
                     check_method_body(ccx, &impl_pty.generics, sig, body,
@@ -757,7 +757,7 @@ pub fn check_item_body<'a,'tcx>(ccx: &CrateCtxt<'a,'tcx>, it: &'tcx hir::Item) {
         for trait_item in trait_items {
             match trait_item.node {
                 hir::ConstTraitItem(_, Some(ref expr)) => {
-                    check_const(ccx, trait_item.span, &*expr, trait_item.id)
+                    check_const(ccx, trait_item.span, &expr, trait_item.id)
                 }
                 hir::MethodTraitItem(ref sig, Some(ref body)) => {
                     check_trait_fn_not_const(ccx, trait_item.span, sig.constness);
@@ -801,7 +801,7 @@ fn check_trait_on_unimplemented<'a, 'tcx>(ccx: &CrateCtxt<'a, 'tcx>,
     }) {
         if let Some(ref istring) = attr.value_str() {
             let parser = Parser::new(&istring);
-            let types = &*generics.ty_params;
+            let types = &generics.ty_params;
             for token in parser {
                 match token {
                     Piece::String(_) => (), // Normal string, no need to check it
@@ -890,7 +890,7 @@ fn check_impl_items_against_trait<'a, 'tcx>(ccx: &CrateCtxt<'a, 'tcx>,
                                            &impl_const,
                                            impl_item.span,
                                            trait_const,
-                                           &*impl_trait_ref);
+                                           &impl_trait_ref);
                     } else {
                         span_err!(tcx.sess, impl_item.span, E0323,
                                   "item `{}` is an associated const, \
@@ -2279,7 +2279,7 @@ fn try_index_step<'a, 'tcx>(fcx: &FnCtxt<'a, 'tcx>,
         (PreferMutLvalue, Some(trait_did)) => {
             method::lookup_in_trait_adjusted(fcx,
                                              expr.span,
-                                             Some(&*base_expr),
+                                             Some(&base_expr),
                                              token::intern("index_mut"),
                                              trait_did,
                                              autoderefs,
@@ -2295,7 +2295,7 @@ fn try_index_step<'a, 'tcx>(fcx: &FnCtxt<'a, 'tcx>,
         (None, Some(trait_did)) => {
             method::lookup_in_trait_adjusted(fcx,
                                              expr.span,
-                                             Some(&*base_expr),
+                                             Some(&base_expr),
                                              token::intern("index"),
                                              trait_did,
                                              autoderefs,
@@ -2409,7 +2409,7 @@ fn check_argument_types<'a, 'tcx>(fcx: &FnCtxt<'a, 'tcx>,
                 } else {
                     expected_arg_tys = match expected_arg_tys.get(0) {
                         Some(&ty) => match ty.sty {
-                            ty::TyTuple(ref tys) => &**tys,
+                            ty::TyTuple(ref tys) => &tys,
                             _ => &[]
                         },
                         None => &[]
@@ -2512,14 +2512,14 @@ fn check_argument_types<'a, 'tcx>(fcx: &FnCtxt<'a, 'tcx>,
                 });
 
                 check_expr_with_unifier(fcx,
-                                        &**arg,
+                                        &arg,
                                         expected.unwrap_or(ExpectHasType(formal_ty)),
                                         NoPreference, || {
                     // 2. Coerce to the most detailed type that could be coerced
                     //    to, which is `expected_ty` if `rvalue_hint` returns an
                     //    `ExprHasType(expected_ty)`, or the `formal_ty` otherwise.
                     let coerce_ty = expected.and_then(|e| e.only_has_type(fcx));
-                    demand::coerce(fcx, arg.span, coerce_ty.unwrap_or(formal_ty), &**arg);
+                    demand::coerce(fcx, arg.span, coerce_ty.unwrap_or(formal_ty), &arg);
 
                     // 3. Relate the expected type and the formal one,
                     //    if the expected type was used for the coercion.
@@ -2549,12 +2549,12 @@ fn check_argument_types<'a, 'tcx>(fcx: &FnCtxt<'a, 'tcx>,
     // arguments which we skipped above.
     if variadic {
         for arg in args.iter().skip(expected_arg_count) {
-            check_expr(fcx, &**arg);
+            check_expr(fcx, &arg);
 
             // There are a few types which get autopromoted when passed via varargs
             // in C but we just error out instead and require explicit casts.
             let arg_ty = structurally_resolved_type(fcx, arg.span,
-                                                    fcx.expr_ty(&**arg));
+                                                    fcx.expr_ty(&arg));
             match arg_ty.sty {
                 ty::TyFloat(ast::FloatTy::F32) => {
                     fcx.type_error_message(arg.span,
@@ -2816,15 +2816,15 @@ fn check_method_call<'a, 'tcx>(fcx: &FnCtxt<'a, 'tcx>,
                                    tps: &[P<hir::Ty>],
                                    expected: Expectation<'tcx>,
                                    lvalue_pref: LvaluePreference) {
-        let rcvr = &*args[0];
-        check_expr_with_lvalue_pref(fcx, &*rcvr, lvalue_pref);
+        let rcvr = &args[0];
+        check_expr_with_lvalue_pref(fcx, &rcvr, lvalue_pref);
 
         // no need to check for bot/err -- callee does that
         let expr_t = structurally_resolved_type(fcx,
                                                 expr.span,
-                                                fcx.expr_ty(&*rcvr));
+                                                fcx.expr_ty(&rcvr));
 
-        let tps = tps.iter().map(|ast_ty| fcx.to_ty(&**ast_ty)).collect::<Vec<_>>();
+        let tps = tps.iter().map(|ast_ty| fcx.to_ty(&ast_ty)).collect::<Vec<_>>();
         let fn_ty = match method::lookup(fcx,
                                          method_name.span,
                                          method_name.node,
@@ -2877,8 +2877,8 @@ fn check_then_else<'a, 'tcx>(fcx: &FnCtxt<'a, 'tcx>,
 
         let branches_ty = match opt_else_expr {
             Some(ref else_expr) => {
-                check_expr_with_expectation(fcx, &**else_expr, expected);
-                let else_ty = fcx.expr_ty(&**else_expr);
+                check_expr_with_expectation(fcx, &else_expr, expected);
+                let else_ty = fcx.expr_ty(&else_expr);
                 infer::common_supertype(fcx.infcx(),
                                         TypeOrigin::IfExpression(sp),
                                         true,
@@ -3128,7 +3128,7 @@ fn check_expr_struct_fields<'a, 'tcx>(fcx: &FnCtxt<'a, 'tcx>,
 
             // Make sure to give a type to the field even if there's
             // an error, so we can continue typechecking
-            check_expr_coercable_to_type(fcx, &*field.expr, expected_field_type);
+            check_expr_coercable_to_type(fcx, &field.expr, expected_field_type);
         }
 
             // Make sure the programmer specified all the fields.
@@ -3156,10 +3156,10 @@ fn check_struct_fields_on_error<'a,'tcx>(fcx: &FnCtxt<'a,'tcx>,
         // otherwise we might ICE
         fcx.write_error(id);
         for field in fields {
-            check_expr(fcx, &*field.expr);
+            check_expr(fcx, &field.expr);
         }
         match *base_expr {
-            Some(ref base) => check_expr(fcx, &**base),
+            Some(ref base) => check_expr(fcx, &base),
             None => {}
         }
     }
@@ -3217,12 +3217,12 @@ fn check_expr_struct<'a, 'tcx>(fcx: &FnCtxt<'a,'tcx>,
             }
         });
         check_expr_with_expectation(fcx, subexpr, expected_inner);
-        let referent_ty = fcx.expr_ty(&**subexpr);
+        let referent_ty = fcx.expr_ty(&subexpr);
         fcx.write_ty(id, tcx.mk_box(referent_ty));
       }
 
       hir::ExprLit(ref lit) => {
-        let typ = check_lit(fcx, &**lit, expected);
+        let typ = check_lit(fcx, &lit, expected);
         fcx.write_ty(id, typ);
       }
       hir::ExprBinary(op, ref lhs, ref rhs) => {
@@ -3245,8 +3245,8 @@ fn check_expr_struct<'a, 'tcx>(fcx: &FnCtxt<'a,'tcx>,
             _ => NoPreference
         };
         check_expr_with_expectation_and_lvalue_pref(
-            fcx, &**oprnd, expected_inner, lvalue_pref);
-        let mut oprnd_t = fcx.expr_ty(&**oprnd);
+            fcx, &oprnd, expected_inner, lvalue_pref);
+        let mut oprnd_t = fcx.expr_ty(&oprnd);
 
         if !oprnd_t.references_error() {
             match unop {
@@ -3256,7 +3256,7 @@ fn check_expr_struct<'a, 'tcx>(fcx: &FnCtxt<'a,'tcx>,
                         Some(mt) => mt.ty,
                         None => match try_overloaded_deref(fcx, expr.span,
                                                            Some(MethodCall::expr(expr.id)),
-                                                           Some(&**oprnd), oprnd_t, lvalue_pref) {
+                                                           Some(&oprnd), oprnd_t, lvalue_pref) {
                             Some(mt) => mt.ty,
                             None => {
                                 fcx.type_error_message(expr.span, |actual| {
@@ -3274,7 +3274,7 @@ fn check_expr_struct<'a, 'tcx>(fcx: &FnCtxt<'a,'tcx>,
                     if !(oprnd_t.is_integral() || oprnd_t.sty == ty::TyBool) {
                         oprnd_t = op::check_user_unop(fcx, "!", "not",
                                                       tcx.lang_items.not_trait(),
-                                                      expr, &**oprnd, oprnd_t, unop);
+                                                      expr, &oprnd, oprnd_t, unop);
                     }
                 }
                 hir::UnNeg => {
@@ -3283,7 +3283,7 @@ fn check_expr_struct<'a, 'tcx>(fcx: &FnCtxt<'a,'tcx>,
                     if !(oprnd_t.is_integral() || oprnd_t.is_fp()) {
                         oprnd_t = op::check_user_unop(fcx, "-", "neg",
                                                       tcx.lang_items.neg_trait(),
-                                                      expr, &**oprnd, oprnd_t, unop);
+                                                      expr, &oprnd, oprnd_t, unop);
                     }
                 }
             }
@@ -3294,7 +3294,7 @@ fn check_expr_struct<'a, 'tcx>(fcx: &FnCtxt<'a,'tcx>,
         let hint = expected.only_has_type(fcx).map_or(NoExpectation, |ty| {
             match ty.sty {
                 ty::TyRef(_, ref mt) | ty::TyRawPtr(ref mt) => {
-                    if fcx.tcx().expr_is_lval(&**oprnd) {
+                    if fcx.tcx().expr_is_lval(&oprnd) {
                         // Lvalues may legitimately have unsized types.
                         // For example, dereferences of a fat pointer and
                         // the last field of a struct can be unsized.
@@ -3308,11 +3308,11 @@ fn check_expr_struct<'a, 'tcx>(fcx: &FnCtxt<'a,'tcx>,
         });
         let lvalue_pref = LvaluePreference::from_mutbl(mutbl);
         check_expr_with_expectation_and_lvalue_pref(fcx,
-                                                    &**oprnd,
+                                                    &oprnd,
                                                     hint,
                                                     lvalue_pref);
 
-        let tm = ty::TypeAndMut { ty: fcx.expr_ty(&**oprnd), mutbl: mutbl };
+        let tm = ty::TypeAndMut { ty: fcx.expr_ty(&oprnd), mutbl: mutbl };
         let oprnd_t = if tm.ty.references_error() {
             tcx.types.err
         } else {
@@ -3381,10 +3381,10 @@ fn check_expr_struct<'a, 'tcx>(fcx: &FnCtxt<'a,'tcx>,
       }
       hir::ExprInlineAsm(ref ia) => {
           for &(_, ref input) in &ia.inputs {
-              check_expr(fcx, &**input);
+              check_expr(fcx, &input);
           }
           for out in &ia.outputs {
-              check_expr(fcx, &*out.expr);
+              check_expr(fcx, &out.expr);
           }
           fcx.write_nil(id);
       }
@@ -3402,13 +3402,13 @@ fn check_expr_struct<'a, 'tcx>(fcx: &FnCtxt<'a,'tcx>,
                                  not `()`");
                         },
                     Some(ref e) => {
-                        check_expr_coercable_to_type(fcx, &**e, result_type);
+                        check_expr_coercable_to_type(fcx, &e, result_type);
                     }
                 }
             }
             ty::FnDiverging => {
                 if let Some(ref e) = *expr_opt {
-                    check_expr(fcx, &**e);
+                    check_expr(fcx, &e);
                 }
                 span_err!(tcx.sess, expr.span, E0166,
                     "`return` in a function declared as diverging");
@@ -3417,19 +3417,19 @@ fn check_expr_struct<'a, 'tcx>(fcx: &FnCtxt<'a,'tcx>,
         fcx.write_ty(id, fcx.infcx().next_diverging_ty_var());
       }
       hir::ExprAssign(ref lhs, ref rhs) => {
-        check_expr_with_lvalue_pref(fcx, &**lhs, PreferMutLvalue);
+        check_expr_with_lvalue_pref(fcx, &lhs, PreferMutLvalue);
 
         let tcx = fcx.tcx();
-        if !tcx.expr_is_lval(&**lhs) {
+        if !tcx.expr_is_lval(&lhs) {
             span_err!(tcx.sess, expr.span, E0070,
                 "invalid left-hand side expression");
         }
 
-        let lhs_ty = fcx.expr_ty(&**lhs);
-        check_expr_coercable_to_type(fcx, &**rhs, lhs_ty);
-        let rhs_ty = fcx.expr_ty(&**rhs);
+        let lhs_ty = fcx.expr_ty(&lhs);
+        check_expr_coercable_to_type(fcx, &rhs, lhs_ty);
+        let rhs_ty = fcx.expr_ty(&rhs);
 
-        fcx.require_expr_have_sized_type(&**lhs, traits::AssignmentLhsSized);
+        fcx.require_expr_have_sized_type(&lhs, traits::AssignmentLhsSized);
 
         if lhs_ty.references_error() || rhs_ty.references_error() {
             fcx.write_error(id);
@@ -3438,13 +3438,13 @@ fn check_expr_struct<'a, 'tcx>(fcx: &FnCtxt<'a,'tcx>,
         }
       }
       hir::ExprIf(ref cond, ref then_blk, ref opt_else_expr) => {
-        check_then_else(fcx, &**cond, &**then_blk, opt_else_expr.as_ref().map(|e| &**e),
+        check_then_else(fcx, &cond, &then_blk, opt_else_expr.as_ref().map(|e| &**e),
                         id, expr.span, expected);
       }
       hir::ExprWhile(ref cond, ref body, _) => {
-        check_expr_has_type(fcx, &**cond, tcx.types.bool);
-        check_block_no_value(fcx, &**body);
-        let cond_ty = fcx.expr_ty(&**cond);
+        check_expr_has_type(fcx, &cond, tcx.types.bool);
+        check_block_no_value(fcx, &body);
+        let cond_ty = fcx.expr_ty(&cond);
         let body_ty = fcx.node_ty(body.id);
         if cond_ty.references_error() || body_ty.references_error() {
             fcx.write_error(id);
@@ -3454,25 +3454,25 @@ fn check_expr_struct<'a, 'tcx>(fcx: &FnCtxt<'a,'tcx>,
         }
       }
       hir::ExprLoop(ref body, _) => {
-        check_block_no_value(fcx, &**body);
-        if !may_break(tcx, expr.id, &**body) {
+        check_block_no_value(fcx, &body);
+        if !may_break(tcx, expr.id, &body) {
             fcx.write_ty(id, fcx.infcx().next_diverging_ty_var());
         } else {
             fcx.write_nil(id);
         }
       }
       hir::ExprMatch(ref discrim, ref arms, match_src) => {
-        _match::check_match(fcx, expr, &**discrim, arms, expected, match_src);
+        _match::check_match(fcx, expr, &discrim, arms, expected, match_src);
       }
       hir::ExprClosure(capture, ref decl, ref body) => {
-          closure::check_expr_closure(fcx, expr, capture, &**decl, &**body, expected);
+          closure::check_expr_closure(fcx, expr, capture, &decl, &body, expected);
       }
       hir::ExprBlock(ref b) => {
-        check_block_with_expected(fcx, &**b, expected);
+        check_block_with_expected(fcx, &b, expected);
         fcx.write_ty(id, fcx.node_ty(b.id));
       }
       hir::ExprCall(ref callee, ref args) => {
-          callee::check_call(fcx, expr, &**callee, &args[..], expected);
+          callee::check_call(fcx, expr, &callee, &args[..], expected);
 
           // we must check that return type of called functions is WF:
           let ret_ty = fcx.expr_ty(expr);
@@ -3480,7 +3480,7 @@ fn check_expr_struct<'a, 'tcx>(fcx: &FnCtxt<'a,'tcx>,
       }
       hir::ExprMethodCall(name, ref tps, ref args) => {
           check_method_call(fcx, expr, name, &args[..], &tps[..], expected, lvalue_pref);
-          let arg_tys = args.iter().map(|a| fcx.expr_ty(&**a));
+          let arg_tys = args.iter().map(|a| fcx.expr_ty(&a));
           let args_err = arg_tys.fold(false, |rest_err, a| rest_err || a.references_error());
           if args_err {
               fcx.write_error(id);
@@ -3488,7 +3488,7 @@ fn check_expr_struct<'a, 'tcx>(fcx: &FnCtxt<'a,'tcx>,
       }
       hir::ExprCast(ref e, ref t) => {
         if let hir::TyFixedLengthVec(_, ref count_expr) = t.node {
-            check_expr_with_hint(fcx, &**count_expr, tcx.types.usize);
+            check_expr_with_hint(fcx, &count_expr, tcx.types.usize);
         }
 
         // Find the type of `e`. Supply hints based on the type we are casting to,
@@ -3516,8 +3516,8 @@ fn check_expr_struct<'a, 'tcx>(fcx: &FnCtxt<'a,'tcx>,
         }
       }
       hir::ExprType(ref e, ref t) => {
-        let typ = fcx.to_ty(&**t);
-        check_expr_eq_type(fcx, &**e, typ);
+        let typ = fcx.to_ty(&t);
+        check_expr_eq_type(fcx, &e, typ);
         fcx.write_ty(id, typ);
       }
       hir::ExprVec(ref args) => {
@@ -3531,14 +3531,14 @@ fn check_expr_struct<'a, 'tcx>(fcx: &FnCtxt<'a,'tcx>,
         let typ = match uty {
             Some(uty) => {
                 for e in args {
-                    check_expr_coercable_to_type(fcx, &**e, uty);
+                    check_expr_coercable_to_type(fcx, &e, uty);
                 }
                 uty
             }
             None => {
                 let t: Ty = fcx.infcx().next_ty_var();
                 for e in args {
-                    check_expr_has_type(fcx, &**e, t);
+                    check_expr_has_type(fcx, &e, t);
                 }
                 t
             }
@@ -3547,8 +3547,8 @@ fn check_expr_struct<'a, 'tcx>(fcx: &FnCtxt<'a,'tcx>,
         fcx.write_ty(id, typ);
       }
       hir::ExprRepeat(ref element, ref count_expr) => {
-        check_expr_has_type(fcx, &**count_expr, tcx.types.usize);
-        let count = fcx.tcx().eval_repeat_count(&**count_expr);
+        check_expr_has_type(fcx, &count_expr, tcx.types.usize);
+        let count = fcx.tcx().eval_repeat_count(&count_expr);
 
         let uty = match expected {
             ExpectHasType(uty) => {
@@ -3562,13 +3562,13 @@ fn check_expr_struct<'a, 'tcx>(fcx: &FnCtxt<'a,'tcx>,
 
         let (element_ty, t) = match uty {
             Some(uty) => {
-                check_expr_coercable_to_type(fcx, &**element, uty);
+                check_expr_coercable_to_type(fcx, &element, uty);
                 (uty, uty)
             }
             None => {
                 let t: Ty = fcx.infcx().next_ty_var();
-                check_expr_has_type(fcx, &**element, t);
-                (fcx.expr_ty(&**element), t)
+                check_expr_has_type(fcx, &element, t);
+                (fcx.expr_ty(&element), t)
             }
         };
 
@@ -3602,12 +3602,12 @@ fn check_expr_struct<'a, 'tcx>(fcx: &FnCtxt<'a,'tcx>,
             let t = match flds {
                 Some(ref fs) if i < fs.len() => {
                     let ety = fs[i];
-                    check_expr_coercable_to_type(fcx, &**e, ety);
+                    check_expr_coercable_to_type(fcx, &e, ety);
                     ety
                 }
                 _ => {
-                    check_expr_with_expectation(fcx, &**e, NoExpectation);
-                    fcx.expr_ty(&**e)
+                    check_expr_with_expectation(fcx, &e, NoExpectation);
+                    fcx.expr_ty(&e)
                 }
             };
             err_field = err_field || t.references_error();
@@ -3626,17 +3626,17 @@ fn check_expr_struct<'a, 'tcx>(fcx: &FnCtxt<'a,'tcx>,
         fcx.require_expr_have_sized_type(expr, traits::StructInitializerSized);
       }
       hir::ExprField(ref base, ref field) => {
-        check_field(fcx, expr, lvalue_pref, &**base, field);
+        check_field(fcx, expr, lvalue_pref, &base, field);
       }
       hir::ExprTupField(ref base, idx) => {
-        check_tup_field(fcx, expr, lvalue_pref, &**base, idx);
+        check_tup_field(fcx, expr, lvalue_pref, &base, idx);
       }
       hir::ExprIndex(ref base, ref idx) => {
-          check_expr_with_lvalue_pref(fcx, &**base, lvalue_pref);
-          check_expr(fcx, &**idx);
+          check_expr_with_lvalue_pref(fcx, &base, lvalue_pref);
+          check_expr(fcx, &idx);
 
-          let base_t = fcx.expr_ty(&**base);
-          let idx_t = fcx.expr_ty(&**idx);
+          let base_t = fcx.expr_ty(&base);
+          let idx_t = fcx.expr_ty(&idx);
 
           if base_t.references_error() {
               fcx.write_ty(id, base_t);
@@ -3651,7 +3651,7 @@ fn check_expr_struct<'a, 'tcx>(fcx: &FnCtxt<'a,'tcx>,
                       fcx.write_ty(id, element_ty);
                   }
                   None => {
-                      check_expr_has_type(fcx, &**idx, fcx.tcx().types.err);
+                      check_expr_has_type(fcx, &idx, fcx.tcx().types.err);
                       fcx.type_error_message(
                           expr.span,
                           |actual| {
@@ -3667,12 +3667,12 @@ fn check_expr_struct<'a, 'tcx>(fcx: &FnCtxt<'a,'tcx>,
        }
        hir::ExprRange(ref start, ref end) => {
           let t_start = start.as_ref().map(|e| {
-            check_expr(fcx, &**e);
-            fcx.expr_ty(&**e)
+            check_expr(fcx, &e);
+            fcx.expr_ty(&e)
           });
           let t_end = end.as_ref().map(|e| {
-            check_expr(fcx, &**e);
-            fcx.expr_ty(&**e)
+            check_expr(fcx, &e);
+            fcx.expr_ty(&e)
           });
 
           let idx_type = match (t_start, t_end) {
@@ -3905,8 +3905,8 @@ pub fn check_decl_local<'a,'tcx>(fcx: &FnCtxt<'a,'tcx>, local: &'tcx hir::Local)
     fcx.write_ty(local.id, t);
 
     if let Some(ref init) = local.init {
-        check_decl_initializer(fcx, local, &**init);
-        let init_ty = fcx.expr_ty(&**init);
+        check_decl_initializer(fcx, local, &init);
+        let init_ty = fcx.expr_ty(&init);
         if init_ty.references_error() {
             fcx.write_ty(local.id, init_ty);
         }
@@ -3914,9 +3914,9 @@ pub fn check_decl_local<'a,'tcx>(fcx: &FnCtxt<'a,'tcx>, local: &'tcx hir::Local)
 
     let pcx = pat_ctxt {
         fcx: fcx,
-        map: pat_id_map(&tcx.def_map, &*local.pat),
+        map: pat_id_map(&tcx.def_map, &local.pat),
     };
-    _match::check_pat(&pcx, &*local.pat, t);
+    _match::check_pat(&pcx, &local.pat, t);
     let pat_ty = fcx.node_ty(local.pat.id);
     if pat_ty.references_error() {
         fcx.write_ty(local.id, pat_ty);
@@ -3932,7 +3932,7 @@ pub fn check_stmt<'a,'tcx>(fcx: &FnCtxt<'a,'tcx>, stmt: &'tcx hir::Stmt)  {
         node_id = id;
         match decl.node {
           hir::DeclLocal(ref l) => {
-              check_decl_local(fcx, &**l);
+              check_decl_local(fcx, &l);
               let l_t = fcx.node_ty(l.id);
               saw_bot = saw_bot || fcx.infcx().type_var_diverges(l_t);
               saw_err = saw_err || l_t.references_error();
@@ -3943,15 +3943,15 @@ pub fn check_stmt<'a,'tcx>(fcx: &FnCtxt<'a,'tcx>, stmt: &'tcx hir::Stmt)  {
       hir::StmtExpr(ref expr, id) => {
         node_id = id;
         // Check with expected type of ()
-        check_expr_has_type(fcx, &**expr, fcx.tcx().mk_nil());
-        let expr_ty = fcx.expr_ty(&**expr);
+        check_expr_has_type(fcx, &expr, fcx.tcx().mk_nil());
+        let expr_ty = fcx.expr_ty(&expr);
         saw_bot = saw_bot || fcx.infcx().type_var_diverges(expr_ty);
         saw_err = saw_err || expr_ty.references_error();
       }
       hir::StmtSemi(ref expr, id) => {
         node_id = id;
-        check_expr(fcx, &**expr);
-        let expr_ty = fcx.expr_ty(&**expr);
+        check_expr(fcx, &expr);
+        let expr_ty = fcx.expr_ty(&expr);
         saw_bot |= fcx.infcx().type_var_diverges(expr_ty);
         saw_err |= expr_ty.references_error();
       }
@@ -4035,12 +4035,12 @@ fn check_block_with_expected<'a, 'tcx>(fcx: &FnCtxt<'a, 'tcx>,
             }
             let ety = match expected {
                 ExpectHasType(ety) => {
-                    check_expr_coercable_to_type(fcx, &**e, ety);
+                    check_expr_coercable_to_type(fcx, &e, ety);
                     ety
                 }
                 _ => {
-                    check_expr_with_expectation(fcx, &**e, expected);
-                    fcx.expr_ty(&**e)
+                    check_expr_with_expectation(fcx, &e, expected);
+                    fcx.expr_ty(&e)
                 }
             };
 
@@ -4608,7 +4608,7 @@ fn push_explicit_angle_bracketed_parameters_from_segment_to_substs<'a, 'tcx>(
             let type_count = type_defs.len(space);
             assert_eq!(substs.types.len(space), 0);
             for (i, typ) in data.types.iter().enumerate() {
-                let t = fcx.to_ty(&**typ);
+                let t = fcx.to_ty(&typ);
                 if i < type_count {
                     substs.types.push(space, t);
                 } else if i == type_count {
@@ -4677,7 +4677,7 @@ fn push_explicit_parenthesized_parameters_from_segment_to_substs<'a, 'tcx>(
         }
 
         let input_tys: Vec<Ty> =
-            data.inputs.iter().map(|ty| fcx.to_ty(&**ty)).collect();
+            data.inputs.iter().map(|ty| fcx.to_ty(&ty)).collect();
 
         let tuple_ty = fcx.tcx().mk_tup(input_tys);
 
@@ -4686,7 +4686,7 @@ fn push_explicit_parenthesized_parameters_from_segment_to_substs<'a, 'tcx>(
         }
 
         let output_ty: Option<Ty> =
-            data.output.as_ref().map(|ty| fcx.to_ty(&**ty));
+            data.output.as_ref().map(|ty| fcx.to_ty(&ty));
 
         let output_ty =
             output_ty.unwrap_or(fcx.tcx().mk_nil());
@@ -4848,7 +4848,7 @@ pub fn structurally_resolved_type<'a, 'tcx>(fcx: &FnCtxt<'a, 'tcx>,
 pub fn may_break(cx: &ty::ctxt, id: ast::NodeId, b: &hir::Block) -> bool {
     // First: is there an unlabeled break immediately
     // inside the loop?
-    (loop_query(&*b, |e| {
+    (loop_query(&b, |e| {
         match *e {
             hir::ExprBreak(None) => true,
             _ => false
index 56b02412c31b2f1c65fb703206e7647868333713..1ee0542f633372c405d6e6f1b5b94c70bd868e13 100644 (file)
@@ -489,7 +489,7 @@ fn visit_block(rcx: &mut Rcx, b: &hir::Block) {
 fn visit_arm(rcx: &mut Rcx, arm: &hir::Arm) {
     // see above
     for p in &arm.pats {
-        constrain_bindings_in_pat(&**p, rcx);
+        constrain_bindings_in_pat(&p, rcx);
     }
 
     intravisit::walk_arm(rcx, arm);
@@ -497,7 +497,7 @@ fn visit_arm(rcx: &mut Rcx, arm: &hir::Arm) {
 
 fn visit_local(rcx: &mut Rcx, l: &hir::Local) {
     // see above
-    constrain_bindings_in_pat(&*l.pat, rcx);
+    constrain_bindings_in_pat(&l.pat, rcx);
     link_local(rcx, l);
     intravisit::walk_local(rcx, l);
 }
@@ -656,10 +656,10 @@ fn visit_expr(rcx: &mut Rcx, expr: &hir::Expr) {
 
         hir::ExprCall(ref callee, ref args) => {
             if has_method_map {
-                constrain_call(rcx, expr, Some(&**callee),
+                constrain_call(rcx, expr, Some(&callee),
                                args.iter().map(|e| &**e), false);
             } else {
-                constrain_callee(rcx, callee.id, expr, &**callee);
+                constrain_callee(rcx, callee.id, expr, &callee);
                 constrain_call(rcx, expr, None,
                                args.iter().map(|e| &**e), false);
             }
@@ -668,7 +668,7 @@ fn visit_expr(rcx: &mut Rcx, expr: &hir::Expr) {
         }
 
         hir::ExprMethodCall(_, _, ref args) => {
-            constrain_call(rcx, expr, Some(&*args[0]),
+            constrain_call(rcx, expr, Some(&args[0]),
                            args[1..].iter().map(|e| &**e), false);
 
             intravisit::walk_expr(rcx, expr);
@@ -676,7 +676,7 @@ fn visit_expr(rcx: &mut Rcx, expr: &hir::Expr) {
 
         hir::ExprAssignOp(_, ref lhs, ref rhs) => {
             if has_method_map {
-                constrain_call(rcx, expr, Some(&**lhs),
+                constrain_call(rcx, expr, Some(&lhs),
                                Some(&**rhs).into_iter(), false);
             }
 
@@ -684,7 +684,7 @@ fn visit_expr(rcx: &mut Rcx, expr: &hir::Expr) {
         }
 
         hir::ExprIndex(ref lhs, ref rhs) if has_method_map => {
-            constrain_call(rcx, expr, Some(&**lhs),
+            constrain_call(rcx, expr, Some(&lhs),
                            Some(&**rhs).into_iter(), true);
 
             intravisit::walk_expr(rcx, expr);
@@ -697,7 +697,7 @@ fn visit_expr(rcx: &mut Rcx, expr: &hir::Expr) {
             // overloaded op.  Note that we (sadly) currently use an
             // implicit "by ref" sort of passing style here.  This
             // should be converted to an adjustment!
-            constrain_call(rcx, expr, Some(&**lhs),
+            constrain_call(rcx, expr, Some(&lhs),
                            Some(&**rhs).into_iter(), implicitly_ref_args);
 
             intravisit::walk_expr(rcx, expr);
@@ -706,8 +706,8 @@ fn visit_expr(rcx: &mut Rcx, expr: &hir::Expr) {
         hir::ExprBinary(_, ref lhs, ref rhs) => {
             // If you do `x OP y`, then the types of `x` and `y` must
             // outlive the operation you are performing.
-            let lhs_ty = rcx.resolve_expr_type_adjusted(&**lhs);
-            let rhs_ty = rcx.resolve_expr_type_adjusted(&**rhs);
+            let lhs_ty = rcx.resolve_expr_type_adjusted(&lhs);
+            let rhs_ty = rcx.resolve_expr_type_adjusted(&rhs);
             for &ty in &[lhs_ty, rhs_ty] {
                 type_must_outlive(rcx,
                                   infer::Operand(expr.span),
@@ -721,7 +721,7 @@ fn visit_expr(rcx: &mut Rcx, expr: &hir::Expr) {
             let implicitly_ref_args = !hir_util::is_by_value_unop(op);
 
             // As above.
-            constrain_call(rcx, expr, Some(&**lhs),
+            constrain_call(rcx, expr, Some(&lhs),
                            None::<hir::Expr>.iter(), implicitly_ref_args);
 
             intravisit::walk_expr(rcx, expr);
@@ -732,7 +732,7 @@ fn visit_expr(rcx: &mut Rcx, expr: &hir::Expr) {
             let method_call = MethodCall::expr(expr.id);
             let base_ty = match rcx.fcx.inh.tables.borrow().method_map.get(&method_call) {
                 Some(method) => {
-                    constrain_call(rcx, expr, Some(&**base),
+                    constrain_call(rcx, expr, Some(&base),
                                    None::<hir::Expr>.iter(), true);
                     let fn_ret = // late-bound regions in overloaded method calls are instantiated
                         rcx.tcx().no_late_bound_regions(&method.ty.fn_ret()).unwrap();
@@ -750,7 +750,7 @@ fn visit_expr(rcx: &mut Rcx, expr: &hir::Expr) {
 
         hir::ExprIndex(ref vec_expr, _) => {
             // For a[b], the lifetime of a must enclose the deref
-            let vec_type = rcx.resolve_expr_type_adjusted(&**vec_expr);
+            let vec_type = rcx.resolve_expr_type_adjusted(&vec_expr);
             constrain_index(rcx, expr, vec_type);
 
             intravisit::walk_expr(rcx, expr);
@@ -760,12 +760,12 @@ fn visit_expr(rcx: &mut Rcx, expr: &hir::Expr) {
             // Determine if we are casting `source` to a trait
             // instance.  If so, we have to be sure that the type of
             // the source obeys the trait's region bound.
-            constrain_cast(rcx, expr, &**source);
+            constrain_cast(rcx, expr, &source);
             intravisit::walk_expr(rcx, expr);
         }
 
         hir::ExprAddrOf(m, ref base) => {
-            link_addr_of(rcx, expr, m, &**base);
+            link_addr_of(rcx, expr, m, &base);
 
             // Require that when you write a `&expr` expression, the
             // resulting pointer has a lifetime that encompasses the
@@ -780,13 +780,13 @@ fn visit_expr(rcx: &mut Rcx, expr: &hir::Expr) {
         }
 
         hir::ExprMatch(ref discr, ref arms, _) => {
-            link_match(rcx, &**discr, &arms[..]);
+            link_match(rcx, &discr, &arms[..]);
 
             intravisit::walk_expr(rcx, expr);
         }
 
         hir::ExprClosure(_, _, ref body) => {
-            check_expr_fn_block(rcx, expr, &**body);
+            check_expr_fn_block(rcx, expr, &body);
         }
 
         hir::ExprLoop(ref body, _) => {
@@ -797,10 +797,10 @@ fn visit_expr(rcx: &mut Rcx, expr: &hir::Expr) {
 
         hir::ExprWhile(ref cond, ref body, _) => {
             let repeating_scope = rcx.set_repeating_scope(cond.id);
-            rcx.visit_expr(&**cond);
+            rcx.visit_expr(&cond);
 
             rcx.set_repeating_scope(body.id);
-            rcx.visit_block(&**body);
+            rcx.visit_block(&body);
 
             rcx.set_repeating_scope(repeating_scope);
         }
@@ -945,7 +945,7 @@ fn constrain_call<'a, I: Iterator<Item=&'a hir::Expr>>(rcx: &mut Rcx,
             rcx, infer::CallRcvr(r.span),
             r.id, callee_region);
         if implicitly_ref_args {
-            link_by_ref(rcx, &*r, callee_scope);
+            link_by_ref(rcx, &r, callee_scope);
         }
     }
 }
@@ -1143,7 +1143,7 @@ fn link_local(rcx: &Rcx, local: &hir::Local) {
     };
     let mc = mc::MemCategorizationContext::new(rcx.fcx.infcx());
     let discr_cmt = ignore_err!(mc.cat_expr(init_expr));
-    link_pattern(rcx, mc, discr_cmt, &*local.pat);
+    link_pattern(rcx, mc, discr_cmt, &local.pat);
 }
 
 /// Computes the guarantors for any ref bindings in a match and
@@ -1156,7 +1156,7 @@ fn link_match(rcx: &Rcx, discr: &hir::Expr, arms: &[hir::Arm]) {
     debug!("discr_cmt={:?}", discr_cmt);
     for arm in arms {
         for root_pat in &arm.pats {
-            link_pattern(rcx, mc, discr_cmt.clone(), &**root_pat);
+            link_pattern(rcx, mc, discr_cmt.clone(), &root_pat);
         }
     }
 }
@@ -1175,7 +1175,7 @@ fn link_fn_args(rcx: &Rcx, body_scope: CodeExtent, args: &[hir::Arg]) {
                arg_ty,
                arg_cmt,
                arg);
-        link_pattern(rcx, mc, arg_cmt, &*arg.pat);
+        link_pattern(rcx, mc, arg_cmt, &arg.pat);
     }
 }
 
@@ -1199,7 +1199,7 @@ fn link_pattern<'t, 'a, 'tcx>(rcx: &Rcx<'a, 'tcx>,
 
                 // `[_, ..slice, _]` pattern
                 hir::PatVec(_, Some(ref slice_pat), _) => {
-                    match mc.cat_slice_pattern(sub_cmt, &**slice_pat) {
+                    match mc.cat_slice_pattern(sub_cmt, &slice_pat) {
                         Ok((slice_cmt, slice_mutbl, slice_r)) => {
                             link_region(rcx, sub_pat.span, &slice_r,
                                         ty::BorrowKind::from_mutbl(slice_mutbl),
index 0b77935771e44b0cb8c81dcfac19b05e3cea9c1d..bc4ec3adbc1853b820fccdc429856bb8ba432c80 100644 (file)
@@ -99,7 +99,7 @@ impl<'a, 'tcx, 'v> Visitor<'v> for SeedBorrowKind<'a, 'tcx> {
     fn visit_expr(&mut self, expr: &hir::Expr) {
         match expr.node {
             hir::ExprClosure(cc, _, ref body) => {
-                self.check_closure(expr, cc, &**body);
+                self.check_closure(expr, cc, &body);
             }
 
             _ => { }
index c2abb074efa136690a25fca2cf752e37f0dbe5ca..e663e449cfc4a3cd922e636ed4ef7f3796daa680 100644 (file)
@@ -53,10 +53,10 @@ pub fn resolve_type_vars_in_fn(fcx: &FnCtxt,
     wbcx.visit_block(blk);
     for arg in &decl.inputs {
         wbcx.visit_node_id(ResolvingPattern(arg.pat.span), arg.id);
-        wbcx.visit_pat(&*arg.pat);
+        wbcx.visit_pat(&arg.pat);
 
         // Privacy needs the type for the whole pattern, not just each binding
-        if !pat_util::pat_is_binding(&fcx.tcx().def_map.borrow(), &*arg.pat) {
+        if !pat_util::pat_is_binding(&fcx.tcx().def_map.borrow(), &arg.pat) {
             wbcx.visit_node_id(ResolvingPattern(arg.pat.span),
                                arg.pat.id);
         }
@@ -221,7 +221,7 @@ fn visit_local(&mut self, l: &hir::Local) {
     fn visit_ty(&mut self, t: &hir::Ty) {
         match t.node {
             hir::TyFixedLengthVec(ref ty, ref count_expr) => {
-                self.visit_ty(&**ty);
+                self.visit_ty(&ty);
                 write_ty_to_tcx(self.tcx(), count_expr.id, self.tcx().types.usize);
             }
             hir::TyBareFn(ref function_declaration) => {
index 035be02b0c30afecbb10b47f11995e6e887075fd..cae2d9d890d7931329ae8b02e87afa25b5a1a1a8 100644 (file)
@@ -273,7 +273,7 @@ fn get_trait_def(&self, trait_id: DefId)
                 _ => tcx.sess.bug(&format!("get_trait_def({:?}): not an item", trait_id))
             };
 
-            trait_def_of_item(self, &*item)
+            trait_def_of_item(self, &item)
         } else {
             tcx.lookup_trait_def(trait_id)
         }
@@ -577,7 +577,7 @@ fn convert_field<'a, 'tcx>(ccx: &CrateCtxt<'a, 'tcx>,
                            v: &hir::StructField,
                            ty_f: ty::FieldDefMaster<'tcx>)
 {
-    let tt = ccx.icx(struct_predicates).to_ty(&ExplicitRscope, &*v.node.ty);
+    let tt = ccx.icx(struct_predicates).to_ty(&ExplicitRscope, &v.node.ty);
     ty_f.fulfill_ty(tt);
     write_ty_to_tcx(ccx.tcx, v.node.id, tt);
 
@@ -709,7 +709,7 @@ fn convert_item(ccx: &CrateCtxt, it: &hir::Item) {
 
             debug!("convert: impl_bounds={:?}", ty_predicates);
 
-            let selfty = ccx.icx(&ty_predicates).to_ty(&ExplicitRscope, &**selfty);
+            let selfty = ccx.icx(&ty_predicates).to_ty(&ExplicitRscope, &selfty);
             write_ty_to_tcx(tcx, it.id, selfty);
 
             tcx.register_item_type(def_id,
@@ -768,7 +768,7 @@ fn convert_item(ccx: &CrateCtxt, it: &hir::Item) {
 
                 if let hir::ImplItemKind::Const(ref ty, _) = impl_item.node {
                     let ty = ccx.icx(&ty_predicates)
-                                .to_ty(&ExplicitRscope, &*ty);
+                                .to_ty(&ExplicitRscope, &ty);
                     tcx.register_item_type(ccx.tcx.map.local_def_id(impl_item.id),
                                            TypeScheme {
                                                generics: ty_generics.clone(),
@@ -1399,11 +1399,11 @@ fn type_scheme_of_def_id<'a,'tcx>(ccx: &CrateCtxt<'a,'tcx>,
     if let Some(node_id) = ccx.tcx.map.as_local_node_id(def_id) {
         match ccx.tcx.map.find(node_id) {
             Some(hir_map::NodeItem(item)) => {
-                type_scheme_of_item(ccx, &*item)
+                type_scheme_of_item(ccx, &item)
             }
             Some(hir_map::NodeForeignItem(foreign_item)) => {
                 let abi = ccx.tcx.map.get_foreign_abi(node_id);
-                type_scheme_of_foreign_item(ccx, &*foreign_item, abi)
+                type_scheme_of_foreign_item(ccx, &foreign_item, abi)
             }
             x => {
                 ccx.tcx.sess.bug(&format!("unexpected sort of node \
@@ -1437,18 +1437,18 @@ fn compute_type_scheme_of_item<'a,'tcx>(ccx: &CrateCtxt<'a,'tcx>,
     let tcx = ccx.tcx;
     match it.node {
         hir::ItemStatic(ref t, _, _) | hir::ItemConst(ref t, _) => {
-            let ty = ccx.icx(&()).to_ty(&ExplicitRscope, &**t);
+            let ty = ccx.icx(&()).to_ty(&ExplicitRscope, &t);
             ty::TypeScheme { ty: ty, generics: ty::Generics::empty() }
         }
         hir::ItemFn(ref decl, unsafety, _, abi, ref generics, _) => {
             let ty_generics = ty_generics_for_fn(ccx, generics, &ty::Generics::empty());
-            let tofd = astconv::ty_of_bare_fn(&ccx.icx(generics), unsafety, abi, &**decl);
+            let tofd = astconv::ty_of_bare_fn(&ccx.icx(generics), unsafety, abi, &decl);
             let ty = tcx.mk_fn(Some(ccx.tcx.map.local_def_id(it.id)), tcx.mk_bare_fn(tofd));
             ty::TypeScheme { ty: ty, generics: ty_generics }
         }
         hir::ItemTy(ref t, ref generics) => {
             let ty_generics = ty_generics_for_type_or_impl(ccx, generics);
-            let ty = ccx.icx(generics).to_ty(&ExplicitRscope, &**t);
+            let ty = ccx.icx(generics).to_ty(&ExplicitRscope, &t);
             ty::TypeScheme { ty: ty, generics: ty_generics }
         }
         hir::ItemEnum(ref ei, ref generics) => {
@@ -1777,7 +1777,7 @@ fn ty_generic_predicates<'a,'tcx>(ccx: &CrateCtxt<'a,'tcx>,
             &hir::WherePredicate::BoundPredicate(ref bound_pred) => {
                 let ty = ast_ty_to_ty(&ccx.icx(&(base_predicates, ast_generics)),
                                       &ExplicitRscope,
-                                      &*bound_pred.bounded_ty);
+                                      &bound_pred.bounded_ty);
 
                 for bound in bound_pred.bounds.iter() {
                     match bound {
@@ -2120,11 +2120,11 @@ fn compute_type_scheme_of_foreign_fn_decl<'a, 'tcx>(
     -> ty::TypeScheme<'tcx>
 {
     for i in &decl.inputs {
-        match (*i).pat.node {
+        match i.pat.node {
             hir::PatIdent(_, _, _) => (),
             hir::PatWild => (),
             _ => {
-                span_err!(ccx.tcx.sess, (*i).pat.span, E0130,
+                span_err!(ccx.tcx.sess, i.pat.span, E0130,
                           "patterns aren't allowed in foreign function declarations");
             }
         }
@@ -2140,7 +2140,7 @@ fn compute_type_scheme_of_foreign_fn_decl<'a, 'tcx>(
 
     let output = match decl.output {
         hir::Return(ref ty) =>
-            ty::FnConverging(ast_ty_to_ty(&ccx.icx(ast_generics), &rb, &**ty)),
+            ty::FnConverging(ast_ty_to_ty(&ccx.icx(ast_generics), &rb, &ty)),
         hir::DefaultReturn(..) =>
             ty::FnConverging(ccx.tcx.mk_nil()),
         hir::NoReturn(..) =>