From 571369af1be0c0a7cc09ac3cf2cd6cfc7da65cff Mon Sep 17 00:00:00 2001 From: Manish Goregaokar Date: Wed, 4 Jan 2017 14:18:11 -0800 Subject: [PATCH] Rustup to rustc 1.16.0-nightly (468227129 2017-01-03): Borrow and spelling fixes --- clippy_lints/src/block_in_if_condition.rs | 3 ++- clippy_lints/src/consts.rs | 4 ++-- clippy_lints/src/enum_clike.rs | 4 ++-- clippy_lints/src/eta_reduction.rs | 2 +- clippy_lints/src/functions.rs | 2 +- clippy_lints/src/methods.rs | 3 +-- clippy_lints/src/shadow.rs | 6 +++--- clippy_lints/src/utils/hir.rs | 8 ++++---- clippy_lints/src/utils/inspector.rs | 8 ++++---- clippy_lints/src/utils/internal_lints.rs | 4 ++-- 10 files changed, 22 insertions(+), 22 deletions(-) diff --git a/clippy_lints/src/block_in_if_condition.rs b/clippy_lints/src/block_in_if_condition.rs index 2e2b6ee8b937..efea48e64040 100644 --- a/clippy_lints/src/block_in_if_condition.rs +++ b/clippy_lints/src/block_in_if_condition.rs @@ -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; diff --git a/clippy_lints/src/consts.rs b/clippy_lints/src/consts.rs index 0fbc71da583a..03eb0fd0540d 100644 --- a/clippy_lints/src/consts.rs +++ b/clippy_lints/src/consts.rs @@ -260,9 +260,9 @@ impl<'c, 'cc> ConstEvalLateContext<'c, 'cc> { 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 } diff --git a/clippy_lints/src/enum_clike.rs b/clippy_lints/src/enum_clike.rs index 72a88be016e9..5168b4abb9d7 100644 --- a/clippy_lints/src/enum_clike.rs +++ b/clippy_lints/src/enum_clike.rs @@ -42,9 +42,9 @@ impl<'a, 'tcx> LateLintPass<'a, 'tcx> for UnportableVariant { 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, diff --git a/clippy_lints/src/eta_reduction.rs b/clippy_lints/src/eta_reduction.rs index 0b34bb99bc7f..c00ab3d0e637 100644 --- a/clippy_lints/src/eta_reduction.rs +++ b/clippy_lints/src/eta_reduction.rs @@ -50,7 +50,7 @@ impl<'a, 'tcx> LateLintPass<'a, 'tcx> for EtaPass { 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 diff --git a/clippy_lints/src/functions.rs b/clippy_lints/src/functions.rs index 7f019e5743fa..24e433739965 100644 --- a/clippy_lints/src/functions.rs +++ b/clippy_lints/src/functions.rs @@ -158,7 +158,7 @@ impl<'a, 'tcx> Functions { } fn raw_ptr_arg(arg: &hir::Arg, ty: &hir::Ty) -> Option { - 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 diff --git a/clippy_lints/src/methods.rs b/clippy_lints/src/methods.rs index ab84a7f927db..0e37ca0fec1f 100644 --- a/clippy_lints/src/methods.rs +++ b/clippy_lints/src/methods.rs @@ -637,8 +637,7 @@ impl<'a, 'tcx> LateLintPass<'a, 'tcx> for Pass { 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 diff --git a/clippy_lints/src/shadow.rs b/clippy_lints/src/shadow.rs index 6cf8a337be1a..e9208a13cf41 100644 --- a/clippy_lints/src/shadow.rs +++ b/clippy_lints/src/shadow.rs @@ -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), _ => (), } } diff --git a/clippy_lints/src/utils/hir.rs b/clippy_lints/src/utils/hir.rs index 643b52496543..454a08135077 100644 --- a/clippy_lints/src/utils/hir.rs +++ b/clippy_lints/src/utils/hir.rs @@ -112,7 +112,7 @@ impl<'a, 'tcx: 'a> SpanlessEq<'a, 'tcx> { !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 @@ impl<'a, 'tcx: 'a> SpanlessEq<'a, 'tcx> { 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 @@ impl<'a, 'tcx: 'a> SpanlessHash<'a, 'tcx> { 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; diff --git a/clippy_lints/src/utils/inspector.rs b/clippy_lints/src/utils/inspector.rs index 220d4572e81d..d9667d9115d3 100644 --- a/clippy_lints/src/utils/inspector.rs +++ b/clippy_lints/src/utils/inspector.rs @@ -60,9 +60,9 @@ impl<'a, 'tcx> LateLintPass<'a, 'tcx> for Pass { 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); }, } } diff --git a/clippy_lints/src/utils/internal_lints.rs b/clippy_lints/src/utils/internal_lints.rs index d2da4f9085b9..ea7a654ed1f7 100644 --- a/clippy_lints/src/utils/internal_lints.rs +++ b/clippy_lints/src/utils/internal_lints.rs @@ -106,7 +106,7 @@ impl LintPass for LintWithoutLintPass { 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 @@ impl<'a, 'tcx> LateLintPass<'a, 'tcx> for LintWithoutLintPass { 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); } } }