Merge pull request #1246 from Manishearth/rustup

Rustup to *rustc 1.14.0-nightly (144af3e97 2016-10-02)* and bump to 0.0.93
This commit is contained in:
Martin Carton 2016-10-03 21:33:08 +02:00 committed by GitHub
commit 9936734cd8
16 changed files with 32 additions and 31 deletions

View File

@ -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`]

View File

@ -1,6 +1,6 @@
[package]
name = "clippy"
version = "0.0.92"
version = "0.0.93"
authors = [
"Manish Goregaokar <manishsmail@gmail.com>",
"Andre Bogus <bogusandre@gmail.com>",
@ -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]

View File

@ -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 <manishsmail@gmail.com>",

View File

@ -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

View File

@ -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)))

View File

@ -265,7 +265,7 @@ fn bindings<'a, 'tcx>(cx: &LateContext<'a, 'tcx>, pat: &Pat) -> HashMap<Interned
bindings_impl(cx, pat, map);
}
}
PatKind::Vec(ref lhs, ref mid, ref rhs) => {
PatKind::Slice(ref lhs, ref mid, ref rhs) => {
for pat in lhs {
bindings_impl(cx, pat, map);
}

View File

@ -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(_, _) |

View File

@ -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,

View File

@ -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<Vec<&'a Exp
match expr.node {
Expr_::ExprIndex(ref a, ref b) |
Expr_::ExprBinary(_, ref a, ref b) => 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, _) |

View File

@ -190,7 +190,7 @@ fn is_trivial_regex(s: &regex_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);

View File

@ -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);
}

View File

@ -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),

View File

@ -180,7 +180,7 @@ pub fn vec_macro<'e>(cx: &LateContext, expr: &'e hir::Expr) -> Option<VecArgs<'e
// `vec![a, b, c]` case
if_let_chain!{[
let hir::ExprBox(ref boxed) = args[0].node,
let hir::ExprVec(ref args) = boxed.node
let hir::ExprArray(ref args) = boxed.node
], {
return Some(VecArgs::Vec(&*args));
}}

View File

@ -125,7 +125,7 @@ impl<'a, 'tcx: 'a> 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);

View File

@ -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))
}
}

View File

@ -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),