From 4f91d6690508c1527c391b22e8ac0446d296e305 Mon Sep 17 00:00:00 2001 From: mcarton Date: Fri, 30 Sep 2016 15:35:24 +0200 Subject: [PATCH 1/2] Rustup to *rustc 1.14.0-nightly (144af3e97 2016-10-02)* --- clippy_lints/src/array_indexing.rs | 10 +++++----- clippy_lints/src/consts.rs | 2 +- clippy_lints/src/copies.rs | 2 +- clippy_lints/src/eval_order_dependence.rs | 2 +- clippy_lints/src/format.rs | 4 ++-- clippy_lints/src/no_effect.rs | 4 ++-- clippy_lints/src/regex.rs | 2 +- clippy_lints/src/shadow.rs | 6 +++--- clippy_lints/src/types.rs | 4 ++-- clippy_lints/src/utils/higher.rs | 2 +- clippy_lints/src/utils/hir.rs | 12 ++++++------ clippy_lints/src/utils/mod.rs | 2 +- clippy_lints/src/utils/sugg.rs | 2 +- 13 files changed, 27 insertions(+), 27 deletions(-) diff --git a/clippy_lints/src/array_indexing.rs b/clippy_lints/src/array_indexing.rs index 5d8a0b8b8f0..4d8f3de5e04 100644 --- a/clippy_lints/src/array_indexing.rs +++ b/clippy_lints/src/array_indexing.rs @@ -1,10 +1,10 @@ use rustc::lint::*; use rustc::middle::const_val::ConstVal; -use rustc::ty::TyArray; +use rustc::ty; use rustc_const_eval::EvalHint::ExprTypeChecked; use rustc_const_eval::eval_const_expr_partial; use rustc_const_math::ConstInt; -use rustc::hir::*; +use rustc::hir; use syntax::ast::RangeLimits; use utils::{self, higher}; @@ -56,11 +56,11 @@ impl LintPass for ArrayIndexing { } impl LateLintPass for ArrayIndexing { - fn check_expr(&mut self, cx: &LateContext, e: &Expr) { - if let ExprIndex(ref array, ref index) = e.node { + fn check_expr(&mut self, cx: &LateContext, e: &hir::Expr) { + if let hir::ExprIndex(ref array, ref index) = e.node { // Array with known size can be checked statically let ty = cx.tcx.expr_ty(array); - if let TyArray(_, size) = ty.sty { + if let ty::TyArray(_, size) = ty.sty { let size = ConstInt::Infer(size as u64); // Index is a constant uint diff --git a/clippy_lints/src/consts.rs b/clippy_lints/src/consts.rs index 19149671e5b..79e2cc86ee4 100644 --- a/clippy_lints/src/consts.rs +++ b/clippy_lints/src/consts.rs @@ -257,7 +257,7 @@ impl<'c, 'cc> ConstEvalLateContext<'c, 'cc> { ExprBlock(ref block) => self.block(block), ExprIf(ref cond, ref then, ref otherwise) => self.ifthenelse(cond, then, otherwise), ExprLit(ref lit) => Some(lit_to_constant(&lit.node)), - ExprVec(ref vec) => self.multi(vec).map(Constant::Vec), + ExprArray(ref vec) => self.multi(vec).map(Constant::Vec), ExprTup(ref tup) => self.multi(tup).map(Constant::Tuple), ExprRepeat(ref value, ref number) => { self.binop_apply(value, number, |v, n| Some(Constant::Repeat(Box::new(v), n.as_u64() as usize))) diff --git a/clippy_lints/src/copies.rs b/clippy_lints/src/copies.rs index 0a0dc6a60c8..b2439cacba2 100644 --- a/clippy_lints/src/copies.rs +++ b/clippy_lints/src/copies.rs @@ -265,7 +265,7 @@ fn bindings<'a, 'tcx>(cx: &LateContext<'a, 'tcx>, pat: &Pat) -> HashMap { + PatKind::Slice(ref lhs, ref mid, ref rhs) => { for pat in lhs { bindings_impl(cx, pat, map); } diff --git a/clippy_lints/src/eval_order_dependence.rs b/clippy_lints/src/eval_order_dependence.rs index 28e385abd82..451ad50f310 100644 --- a/clippy_lints/src/eval_order_dependence.rs +++ b/clippy_lints/src/eval_order_dependence.rs @@ -213,7 +213,7 @@ fn check_expr<'v, 't>(vis: & mut ReadVisitor<'v, 't>, expr: &'v Expr) -> StopEar } match expr.node { - ExprVec(_) | + ExprArray(_) | ExprTup(_) | ExprMethodCall(_, _, _) | ExprCall(_, _) | diff --git a/clippy_lints/src/format.rs b/clippy_lints/src/format.rs index a6e40bd05c0..0cae23dd62c 100644 --- a/clippy_lints/src/format.rs +++ b/clippy_lints/src/format.rs @@ -82,7 +82,7 @@ pub fn get_argument_fmtstr_parts<'a, 'b>(cx: &LateContext<'a, 'b>, expr: &'a Exp decl.name.as_str() == "__STATIC_FMTSTR", let ItemStatic(_, _, ref expr) = decl.node, let ExprAddrOf(_, ref expr) = expr.node, // &["…", "…", …] - let ExprVec(ref exprs) = expr.node, + let ExprArray(ref exprs) = expr.node, ], { let mut result = Vec::new(); for expr in exprs { @@ -123,7 +123,7 @@ fn check_arg_is_display(cx: &LateContext, expr: &Expr) -> bool { arms[0].pats.len() == 1, let PatKind::Tuple(ref pat, None) = arms[0].pats[0].node, pat.len() == 1, - let ExprVec(ref exprs) = arms[0].body.node, + let ExprArray(ref exprs) = arms[0].body.node, exprs.len() == 1, let ExprCall(_, ref args) = exprs[0].node, args.len() == 2, diff --git a/clippy_lints/src/no_effect.rs b/clippy_lints/src/no_effect.rs index 18f1ce6a1f2..c0950de6d1a 100644 --- a/clippy_lints/src/no_effect.rs +++ b/clippy_lints/src/no_effect.rs @@ -50,7 +50,7 @@ fn has_no_effect(cx: &LateContext, expr: &Expr) -> bool { Expr_::ExprPath(..) => true, Expr_::ExprIndex(ref a, ref b) | Expr_::ExprBinary(_, ref a, ref b) => has_no_effect(cx, a) && has_no_effect(cx, b), - Expr_::ExprVec(ref v) | + Expr_::ExprArray(ref v) | Expr_::ExprTup(ref v) => v.iter().all(|val| has_no_effect(cx, val)), Expr_::ExprRepeat(ref inner, _) | Expr_::ExprCast(ref inner, _) | @@ -130,7 +130,7 @@ fn reduce_expression<'a>(cx: &LateContext, expr: &'a Expr) -> Option Some(vec![&**a, &**b]), - Expr_::ExprVec(ref v) | + Expr_::ExprArray(ref v) | Expr_::ExprTup(ref v) => Some(v.iter().map(Deref::deref).collect()), Expr_::ExprRepeat(ref inner, _) | Expr_::ExprCast(ref inner, _) | diff --git a/clippy_lints/src/regex.rs b/clippy_lints/src/regex.rs index 770c524b946..ab0c4f237c2 100644 --- a/clippy_lints/src/regex.rs +++ b/clippy_lints/src/regex.rs @@ -190,7 +190,7 @@ fn is_trivial_regex(s: ®ex_syntax::Expr) -> Option<&'static str> { fn check_set(cx: &LateContext, expr: &Expr, utf8: bool) { if_let_chain! {[ let ExprAddrOf(_, ref expr) = expr.node, - let ExprVec(ref exprs) = expr.node, + let ExprArray(ref exprs) = expr.node, ], { for expr in exprs { check_regex(cx, expr, utf8); diff --git a/clippy_lints/src/shadow.rs b/clippy_lints/src/shadow.rs index 2794cd14304..53ee8295768 100644 --- a/clippy_lints/src/shadow.rs +++ b/clippy_lints/src/shadow.rs @@ -281,7 +281,7 @@ fn check_expr(cx: &LateContext, expr: &Expr, bindings: &mut Vec<(Name, Span)>) { ExprLoop(ref block, _) => check_block(cx, block, bindings), // ExprCall // ExprMethodCall - ExprVec(ref v) | ExprTup(ref v) => { + ExprArray(ref v) | ExprTup(ref v) => { for e in v { check_expr(cx, e, bindings) } @@ -319,8 +319,8 @@ fn check_expr(cx: &LateContext, expr: &Expr, bindings: &mut Vec<(Name, Span)>) { fn check_ty(cx: &LateContext, ty: &Ty, bindings: &mut Vec<(Name, Span)>) { match ty.node { TyObjectSum(ref sty, _) | - TyVec(ref sty) => check_ty(cx, sty, bindings), - TyFixedLengthVec(ref fty, ref expr) => { + TySlice(ref sty) => check_ty(cx, sty, bindings), + TyArray(ref fty, ref expr) => { check_ty(cx, fty, bindings); check_expr(cx, expr, bindings); } diff --git a/clippy_lints/src/types.rs b/clippy_lints/src/types.rs index 897df4e6170..40bd87f08cd 100644 --- a/clippy_lints/src/types.rs +++ b/clippy_lints/src/types.rs @@ -627,9 +627,9 @@ impl<'v> Visitor<'v> for TypeComplexityVisitor { // the "normal" components of a type: named types, arrays/tuples TyPath(..) | - TyVec(..) | + TySlice(..) | TyTup(..) | - TyFixedLengthVec(..) => (10 * self.nest, 1), + TyArray(..) => (10 * self.nest, 1), // "Sum" of trait bounds TyObjectSum(..) => (20 * self.nest, 0), diff --git a/clippy_lints/src/utils/higher.rs b/clippy_lints/src/utils/higher.rs index aed07471a65..f9c94029bce 100644 --- a/clippy_lints/src/utils/higher.rs +++ b/clippy_lints/src/utils/higher.rs @@ -180,7 +180,7 @@ pub fn vec_macro<'e>(cx: &LateContext, expr: &'e hir::Expr) -> Option SpanlessEq<'a, 'tcx> { (&ExprTup(ref l_tup), &ExprTup(ref r_tup)) => self.eq_exprs(l_tup, r_tup), (&ExprTupField(ref le, li), &ExprTupField(ref re, ri)) => li.node == ri.node && self.eq_expr(le, re), (&ExprUnary(l_op, ref le), &ExprUnary(r_op, ref re)) => l_op == r_op && self.eq_expr(le, re), - (&ExprVec(ref l), &ExprVec(ref r)) => self.eq_exprs(l, r), + (&ExprArray(ref l), &ExprArray(ref r)) => self.eq_exprs(l, r), (&ExprWhile(ref lc, ref lb, ref ll), &ExprWhile(ref rc, ref rb, ref rl)) => { self.eq_expr(lc, rc) && self.eq_block(lb, rb) && both(ll, rl, |l, r| l.node.as_str() == r.node.as_str()) } @@ -166,7 +166,7 @@ impl<'a, 'tcx: 'a> SpanlessEq<'a, 'tcx> { self.eq_expr(ls, rs) && self.eq_expr(le, re) } (&PatKind::Ref(ref le, ref lm), &PatKind::Ref(ref re, ref rm)) => lm == rm && self.eq_pat(le, re), - (&PatKind::Vec(ref ls, ref li, ref le), &PatKind::Vec(ref rs, ref ri, ref re)) => { + (&PatKind::Slice(ref ls, ref li, ref le), &PatKind::Slice(ref rs, ref ri, ref re)) => { over(ls, rs, |l, r| self.eq_pat(l, r)) && over(le, re, |l, r| self.eq_pat(l, r)) && both(li, ri, |l, r| self.eq_pat(l, r)) } @@ -211,8 +211,8 @@ impl<'a, 'tcx: 'a> SpanlessEq<'a, 'tcx> { fn eq_ty(&self, left: &Ty, right: &Ty) -> bool { match (&left.node, &right.node) { - (&TyVec(ref l_vec), &TyVec(ref r_vec)) => self.eq_ty(l_vec, r_vec), - (&TyFixedLengthVec(ref lt, ref ll), &TyFixedLengthVec(ref rt, ref rl)) => { + (&TySlice(ref l_vec), &TySlice(ref r_vec)) => self.eq_ty(l_vec, r_vec), + (&TyArray(ref lt, ref ll), &TyArray(ref rt, ref rl)) => { self.eq_ty(lt, rt) && self.eq_expr(ll, rl) } (&TyPtr(ref l_mut), &TyPtr(ref r_mut)) => l_mut.mutbl == r_mut.mutbl && self.eq_ty(&*l_mut.ty, &*r_mut.ty), @@ -490,8 +490,8 @@ impl<'a, 'tcx: 'a> SpanlessHash<'a, 'tcx> { lop.hash(&mut self.s); self.hash_expr(le); } - ExprVec(ref v) => { - let c: fn(_) -> _ = ExprVec; + ExprArray(ref v) => { + let c: fn(_) -> _ = ExprArray; c.hash(&mut self.s); self.hash_exprs(v); diff --git a/clippy_lints/src/utils/mod.rs b/clippy_lints/src/utils/mod.rs index 0f5afde9508..edec67a8b2b 100644 --- a/clippy_lints/src/utils/mod.rs +++ b/clippy_lints/src/utils/mod.rs @@ -750,7 +750,7 @@ pub fn is_refutable(cx: &LateContext, pat: &Pat) -> bool { are_refutable(cx, pats.iter().map(|pat| &**pat)) } } - PatKind::Vec(ref head, ref middle, ref tail) => { + PatKind::Slice(ref head, ref middle, ref tail) => { are_refutable(cx, head.iter().chain(middle).chain(tail.iter()).map(|pat| &**pat)) } } diff --git a/clippy_lints/src/utils/sugg.rs b/clippy_lints/src/utils/sugg.rs index 560ec491b45..1dc2629d207 100644 --- a/clippy_lints/src/utils/sugg.rs +++ b/clippy_lints/src/utils/sugg.rs @@ -50,6 +50,7 @@ impl<'a> Sugg<'a> { hir::ExprUnary(..) | hir::ExprMatch(..) => Sugg::MaybeParen(snippet), hir::ExprAgain(..) | + hir::ExprArray(..) | hir::ExprBlock(..) | hir::ExprBreak(..) | hir::ExprCall(..) | @@ -65,7 +66,6 @@ impl<'a> Sugg<'a> { hir::ExprStruct(..) | hir::ExprTup(..) | hir::ExprTupField(..) | - hir::ExprVec(..) | hir::ExprWhile(..) => Sugg::NonParen(snippet), hir::ExprAssign(..) => Sugg::BinOp(AssocOp::Assign, snippet), hir::ExprAssignOp(op, ..) => Sugg::BinOp(hirbinop2assignop(op), snippet), From 1c035f7cf9f3d08010ad07e740a614688f6497fb Mon Sep 17 00:00:00 2001 From: mcarton Date: Mon, 3 Oct 2016 21:26:25 +0200 Subject: [PATCH 2/2] Bump to 0.0.93 --- CHANGELOG.md | 3 ++- Cargo.toml | 4 ++-- clippy_lints/Cargo.toml | 2 +- 3 files changed, 5 insertions(+), 4 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index d82e16f02a9..556c070b344 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,7 +1,8 @@ # Change Log All notable changes to this project will be documented in this file. -## 0.0.93 — ? +## 0.0.93 — 2016-10-03 +* Rustup to *rustc 1.14.0-nightly (144af3e97 2016-10-02)* * [`option_map_unwrap_or`] and [`option_map_unwrap_or_else`] are now allowed by default. * New lint: [`explicit_into_iter_loop`] diff --git a/Cargo.toml b/Cargo.toml index 61349cd0490..33902bcdc79 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "clippy" -version = "0.0.92" +version = "0.0.93" authors = [ "Manish Goregaokar ", "Andre Bogus ", @@ -25,7 +25,7 @@ test = false [dependencies] # begin automatic update -clippy_lints = { version = "0.0.92", path = "clippy_lints" } +clippy_lints = { version = "0.0.93", path = "clippy_lints" } # end automatic update [dev-dependencies] diff --git a/clippy_lints/Cargo.toml b/clippy_lints/Cargo.toml index 3335b5f8767..f674da56dac 100644 --- a/clippy_lints/Cargo.toml +++ b/clippy_lints/Cargo.toml @@ -1,7 +1,7 @@ [package] name = "clippy_lints" # begin automatic update -version = "0.0.92" +version = "0.0.93" # end automatic update authors = [ "Manish Goregaokar ",