]> git.lizzy.rs Git - rust.git/commitdiff
Rustup to rustc 1.16.0-nightly (468227129 2017-01-03): Borrow and spelling fixes
authorManish Goregaokar <manishsmail@gmail.com>
Wed, 4 Jan 2017 22:18:11 +0000 (14:18 -0800)
committerManish Goregaokar <manishsmail@gmail.com>
Wed, 4 Jan 2017 23:50:50 +0000 (15:50 -0800)
clippy_lints/src/block_in_if_condition.rs
clippy_lints/src/consts.rs
clippy_lints/src/enum_clike.rs
clippy_lints/src/eta_reduction.rs
clippy_lints/src/functions.rs
clippy_lints/src/methods.rs
clippy_lints/src/shadow.rs
clippy_lints/src/utils/hir.rs
clippy_lints/src/utils/inspector.rs
clippy_lints/src/utils/internal_lints.rs

index 2e2b6ee8b93704de35a0c85039daa81033658b31..efea48e64040c374823b99844baad723e9aef8ad 100644 (file)
@@ -57,7 +57,8 @@ struct ExVisitor<'a, 'tcx: 'a> {
 impl<'a, 'tcx: 'a> Visitor<'tcx> for ExVisitor<'a, 'tcx> {
     fn visit_expr(&mut self, expr: &'tcx Expr) {
         if let ExprClosure(_, _, eid, _) = expr.node {
-            let expr = self.cx.tcx.map.body(eid).value;
+            let body = self.cx.tcx.map.body(eid);
+            let expr = &body.value;
             if matches!(expr.node, ExprBlock(_)) {
                 self.found_block = Some(&expr);
                 return;
index 0fbc71da583a3e37dadcf8f8a1aad72329b0ad42..03eb0fd0540db792c68a3b33be57831c23740313 100644 (file)
@@ -260,9 +260,9 @@ fn expr(&mut self, e: &Expr) -> Option<Constant> {
             ExprLit(ref lit) => Some(lit_to_constant(&lit.node)),
             ExprArray(ref vec) => self.multi(vec).map(Constant::Vec),
             ExprTup(ref tup) => self.multi(tup).map(Constant::Tuple),
-            ExprRepeat(ref value, numberId) => {
+            ExprRepeat(ref value, number_id) => {
                 if let Some(lcx) = self.lcx {
-                    self.binop_apply(value, &lcx.tcx.map.body(numberId).value, |v, n| Some(Constant::Repeat(Box::new(v), n.as_u64() as usize)))
+                    self.binop_apply(value, &lcx.tcx.map.body(number_id).value, |v, n| Some(Constant::Repeat(Box::new(v), n.as_u64() as usize)))
                 } else {
                     None
                 }
index 72a88be016e9b52dec178a86dfdd98e014337879..5168b4abb9d77412f12ce737fc4ec20effcf45cf 100644 (file)
@@ -42,9 +42,9 @@ fn check_item(&mut self, cx: &LateContext<'a, 'tcx>, item: &'tcx Item) {
         if let ItemEnum(ref def, _) = item.node {
             for var in &def.variants {
                 let variant = &var.node;
-                if let Some(bodyId) = variant.disr_expr {
+                if let Some(body_id) = variant.disr_expr {
                     use rustc_const_eval::*;
-                    let bad = match eval_const_expr_partial(cx.tcx, &cx.tcx.map.body(bodyId).value, EvalHint::ExprTypeChecked, None) {
+                    let bad = match eval_const_expr_partial(cx.tcx, &cx.tcx.map.body(body_id).value, EvalHint::ExprTypeChecked, None) {
                         Ok(ConstVal::Integral(Usize(Us64(i)))) => i as u32 as u64 != i,
                         Ok(ConstVal::Integral(Isize(Is64(i)))) => i as i32 as i64 != i,
                         _ => false,
index 0b34bb99bc7f4f2c0ea6fe9dff3f26a38386a177..c00ab3d0e637eb61c6d5f5c8fc92c31ba76d8b0e 100644 (file)
@@ -50,7 +50,7 @@ fn check_expr(&mut self, cx: &LateContext<'a, 'tcx>, expr: &'tcx Expr) {
 fn check_closure(cx: &LateContext, expr: &Expr) {
     if let ExprClosure(_, ref decl, eid, _) = expr.node {
         let body = cx.tcx.map.body(eid);
-        let ex = body.value;
+        let ref ex = body.value;
         if let ExprCall(ref caller, ref args) = ex.node {
             if args.len() != decl.inputs.len() {
                 // Not the same number of arguments, there
index 7f019e5743fab4a6fc8a4d7fb6d8fe473497a49f..24e4337399659b8c71a068bc736e700a37e9af1e 100644 (file)
@@ -158,7 +158,7 @@ fn check_raw_ptr(
 }
 
 fn raw_ptr_arg(arg: &hir::Arg, ty: &hir::Ty) -> Option<hir::def_id::DefId> {
-    if let (&hir::PatKind::Binding(_, def_id, _, _), hir::TyPtr(_)) = (&arg.pat.node, ty.node) {
+    if let (&hir::PatKind::Binding(_, def_id, _, _), &hir::TyPtr(_)) = (&arg.pat.node, &ty.node) {
         Some(def_id)
     } else {
         None
index ab84a7f927db9c6855b78e66e9262d2a4833d35f..0e37ca0fec1f08ee2264be695f01f12019bd30fc 100644 (file)
@@ -637,8 +637,7 @@ fn check_impl_item(&mut self, cx: &LateContext<'a, 'tcx>, implitem: &'tcx hir::I
         let item = cx.tcx.map.expect_item(parent);
         if_let_chain! {[
             let hir::ImplItemKind::Method(ref sig, id) = implitem.node,
-            let body = cx.tcx.map.body(id),
-            let Some(first_arg) = iter_input_pats(&sig.decl, body).next(),
+            let Some(first_arg) = iter_input_pats(&sig.decl, cx.tcx.map.body(id)).next(),
             let hir::ItemImpl(_, _, _, None, _, _) = item.node,
         ], {
             // check missing trait implementations
index 6cf8a337be1a68558ecfad19f094cc4dbc5ba108..e9208a13cf4172a6eb1f7b40cee66d9db5c2e734 100644 (file)
@@ -341,9 +341,9 @@ fn check_ty<'a, 'tcx>(cx: &LateContext<'a, 'tcx>, ty: &'tcx Ty, bindings: &mut V
     match ty.node {
         TyObjectSum(ref sty, _) |
         TySlice(ref sty) => check_ty(cx, sty, bindings),
-        TyArray(ref fty, bodyId) => {
+        TyArray(ref fty, body_id) => {
             check_ty(cx, fty, bindings);
-            check_expr(cx, &cx.tcx.map.body(bodyId).value, bindings);
+            check_expr(cx, &cx.tcx.map.body(body_id).value, bindings);
         },
         TyPtr(MutTy { ty: ref mty, .. }) |
         TyRptr(_, MutTy { ty: ref mty, .. }) => check_ty(cx, mty, bindings),
@@ -352,7 +352,7 @@ fn check_ty<'a, 'tcx>(cx: &LateContext<'a, 'tcx>, ty: &'tcx Ty, bindings: &mut V
                 check_ty(cx, t, bindings)
             }
         },
-        TyTypeof(bodyId) => check_expr(cx, &cx.tcx.map.body(bodyId).value, bindings),
+        TyTypeof(body_id) => check_expr(cx, &cx.tcx.map.body(body_id).value, bindings),
         _ => (),
     }
 }
index 643b5249654376998abeef2e2d43c2fd9d9e995e..454a0813507793f50576373cf60b7d483007d147 100644 (file)
@@ -112,7 +112,7 @@ pub fn eq_expr(&self, left: &Expr, right: &Expr) -> bool {
                 !self.ignore_fn && l_name.node == r_name.node && over(l_tys, r_tys, |l, r| self.eq_ty(l, r)) &&
                 self.eq_exprs(l_args, r_args)
             },
-            (&ExprRepeat(ref le, llId), &ExprRepeat(ref re, rlId)) => self.eq_expr(le, re) && self.eq_expr(&self.cx.tcx.map.body(llId).value, &self.cx.tcx.map.body(rlId).value),
+            (&ExprRepeat(ref le, ll_id), &ExprRepeat(ref re, rl_id)) => self.eq_expr(le, re) && self.eq_expr(&self.cx.tcx.map.body(ll_id).value, &self.cx.tcx.map.body(rl_id).value),
             (&ExprRet(ref l), &ExprRet(ref r)) => both(l, r, |l, r| self.eq_expr(l, r)),
             (&ExprPath(ref l), &ExprPath(ref r)) => self.eq_qpath(l, r),
             (&ExprStruct(ref l_path, ref lf, ref lo), &ExprStruct(ref r_path, ref rf, ref ro)) => {
@@ -211,7 +211,7 @@ fn eq_path_segment(&self, left: &PathSegment, right: &PathSegment) -> bool {
     fn eq_ty(&self, left: &Ty, right: &Ty) -> bool {
         match (&left.node, &right.node) {
             (&TySlice(ref l_vec), &TySlice(ref r_vec)) => self.eq_ty(l_vec, r_vec),
-            (&TyArray(ref lt, llId), &TyArray(ref rt, rlId)) => self.eq_ty(lt, rt) && self.eq_expr(&self.cx.tcx.map.body(llId).value, &self.cx.tcx.map.body(rlId).value),
+            (&TyArray(ref lt, ll_id), &TyArray(ref rt, rl_id)) => self.eq_ty(lt, rt) && self.eq_expr(&self.cx.tcx.map.body(ll_id).value, &self.cx.tcx.map.body(rl_id).value),
             (&TyPtr(ref l_mut), &TyPtr(ref r_mut)) => l_mut.mutbl == r_mut.mutbl && self.eq_ty(&*l_mut.ty, &*r_mut.ty),
             (&TyRptr(_, ref l_rmut), &TyRptr(_, ref r_rmut)) => {
                 l_rmut.mutbl == r_rmut.mutbl && self.eq_ty(&*l_rmut.ty, &*r_rmut.ty)
@@ -424,11 +424,11 @@ pub fn hash_expr(&mut self, e: &Expr) {
                 self.hash_name(&name.node);
                 self.hash_exprs(args);
             },
-            ExprRepeat(ref e, lId) => {
+            ExprRepeat(ref e, l_id) => {
                 let c: fn(_, _) -> _ = ExprRepeat;
                 c.hash(&mut self.s);
                 self.hash_expr(e);
-                self.hash_expr(&self.cx.tcx.map.body(lId).value);
+                self.hash_expr(&self.cx.tcx.map.body(l_id).value);
             },
             ExprRet(ref e) => {
                 let c: fn(_) -> _ = ExprRet;
index 220d4572e81d755613daa32de6ae638edd659427..d9667d9115d33f9f6a73e7f472679bbbfc0bafa4 100644 (file)
@@ -60,9 +60,9 @@ fn check_impl_item(&mut self, cx: &LateContext<'a, 'tcx>, item: &'tcx hir::ImplI
             println!("default");
         }
         match item.node {
-            hir::ImplItemKind::Const(_, bodyId) => {
+            hir::ImplItemKind::Const(_, body_id) => {
                 println!("associated constant");
-                print_expr(cx, &cx.tcx.map.body(bodyId).value, 1);
+                print_expr(cx, &cx.tcx.map.body(body_id).value, 1);
             },
             hir::ImplItemKind::Method(..) => println!("method"),
             hir::ImplItemKind::Type(_) => println!("associated type"),
@@ -324,12 +324,12 @@ fn print_expr(cx: &LateContext, expr: &hir::Expr, indent: usize) {
                 print_expr(cx, base, indent + 1);
             }
         },
-        hir::ExprRepeat(ref val, bodyId) => {
+        hir::ExprRepeat(ref val, body_id) => {
             println!("{}Repeat, {}", ind, ty);
             println!("{}value:", ind);
             print_expr(cx, val, indent + 1);
             println!("{}repeat count:", ind);
-            print_expr(cx, &cx.tcx.map.body(bodyId).value, indent + 1);
+            print_expr(cx, &cx.tcx.map.body(body_id).value, indent + 1);
         },
     }
 }
index d2da4f9085b907c3be19900dcedb86c4a64bf4c2..ea7a654ed1f7d0eb7b4c72290699b7359e8e3b21 100644 (file)
@@ -106,7 +106,7 @@ fn get_lints(&self) -> LintArray {
 
 impl<'a, 'tcx> LateLintPass<'a, 'tcx> for LintWithoutLintPass {
     fn check_item(&mut self, cx: &LateContext<'a, 'tcx>, item: &'tcx Item) {
-        if let ItemStatic(ref ty, MutImmutable, bodyId) = item.node {
+        if let ItemStatic(ref ty, MutImmutable, body_id) = item.node {
             if is_lint_ref_type(ty) {
                 self.declared_lints.insert(item.name, item.span);
             } else if is_lint_array_type(ty) && item.vis == Visibility::Inherited && item.name == "ARRAY" {
@@ -114,7 +114,7 @@ fn check_item(&mut self, cx: &LateContext<'a, 'tcx>, item: &'tcx Item) {
                     output: &mut self.registered_lints,
                     cx: cx,
                 };
-                collector.visit_expr(&cx.tcx.map.body(bodyId).value);
+                collector.visit_expr(&cx.tcx.map.body(body_id).value);
             }
         }
     }