Skip to content

Rustup to *rustc 1.14.0-nightly (144af3e97 2016-10-02)* and bump to 0.0.93 #1246

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Oct 3, 2016
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -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`]
Expand Down
4 changes: 2 additions & 2 deletions Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "clippy"
version = "0.0.92"
version = "0.0.93"
authors = [
"Manish Goregaokar <[email protected]>",
"Andre Bogus <[email protected]>",
Expand All @@ -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]
Expand Down
2 changes: 1 addition & 1 deletion clippy_lints/Cargo.toml
Original file line number Diff line number Diff line change
@@ -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 <[email protected]>",
Expand Down
10 changes: 5 additions & 5 deletions clippy_lints/src/array_indexing.rs
Original file line number Diff line number Diff line change
@@ -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;
Copy link
Member Author

@mcarton mcarton Sep 30, 2016

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@Manishearth, @llogiq, @oli-obk
use rustc::hir;, use syntax::ast; and use rustc::ty; make updates like this much easier (ie. sed-able) than use rustc::hir::* or use rustc::ty::TyArray; and I tend to find them clearer. (here there now happens to be something named TyArray in both ty and hir).
Could we decide to prefer that style in the future?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

wfm

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I like non-glob imports better, too, but I can't promise that I won't accidentally add some, we should create a lint for that (#1228)

use syntax::ast::RangeLimits;
use utils::{self, higher};

Expand Down Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion clippy_lints/src/consts.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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)))
Expand Down
2 changes: 1 addition & 1 deletion clippy_lints/src/copies.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
Expand Down
2 changes: 1 addition & 1 deletion clippy_lints/src/eval_order_dependence.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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(_, _) |
Expand Down
4 changes: 2 additions & 2 deletions clippy_lints/src/format.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down Expand Up @@ -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,
Expand Down
4 changes: 2 additions & 2 deletions clippy_lints/src/no_effect.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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, _) |
Expand Down Expand Up @@ -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, _) |
Expand Down
2 changes: 1 addition & 1 deletion clippy_lints/src/regex.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
6 changes: 3 additions & 3 deletions clippy_lints/src/shadow.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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)
}
Expand Down Expand Up @@ -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);
}
Expand Down
4 changes: 2 additions & 2 deletions clippy_lints/src/types.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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),
Expand Down
2 changes: 1 addition & 1 deletion clippy_lints/src/utils/higher.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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));
}}
Expand Down
12 changes: 6 additions & 6 deletions clippy_lints/src/utils/hir.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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())
}
Expand Down Expand Up @@ -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))
}
Expand Down Expand Up @@ -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),
Expand Down Expand Up @@ -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);
Expand Down
2 changes: 1 addition & 1 deletion clippy_lints/src/utils/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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))
}
}
Expand Down
2 changes: 1 addition & 1 deletion clippy_lints/src/utils/sugg.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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(..) |
Expand All @@ -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),
Expand Down