Skip to content

Commit 7fb99b4

Browse files
committed
Rustup
1 parent c39ca24 commit 7fb99b4

13 files changed

+27
-27
lines changed

clippy_lints/src/array_indexing.rs

+5-5
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
use rustc::lint::*;
22
use rustc::middle::const_val::ConstVal;
3-
use rustc::ty::TyArray;
3+
use rustc::ty;
44
use rustc_const_eval::EvalHint::ExprTypeChecked;
55
use rustc_const_eval::eval_const_expr_partial;
66
use rustc_const_math::ConstInt;
7-
use rustc::hir::*;
7+
use rustc::hir;
88
use syntax::ast::RangeLimits;
99
use utils::{self, higher};
1010

@@ -56,11 +56,11 @@ impl LintPass for ArrayIndexing {
5656
}
5757

5858
impl LateLintPass for ArrayIndexing {
59-
fn check_expr(&mut self, cx: &LateContext, e: &Expr) {
60-
if let ExprIndex(ref array, ref index) = e.node {
59+
fn check_expr(&mut self, cx: &LateContext, e: &hir::Expr) {
60+
if let hir::ExprIndex(ref array, ref index) = e.node {
6161
// Array with known size can be checked statically
6262
let ty = cx.tcx.expr_ty(array);
63-
if let TyArray(_, size) = ty.sty {
63+
if let ty::TyArray(_, size) = ty.sty {
6464
let size = ConstInt::Infer(size as u64);
6565

6666
// Index is a constant uint

clippy_lints/src/consts.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -268,7 +268,7 @@ impl<'c, 'cc> ConstEvalLateContext<'c, 'cc> {
268268
ExprBlock(ref block) => self.block(block),
269269
ExprIf(ref cond, ref then, ref otherwise) => self.ifthenelse(cond, then, otherwise),
270270
ExprLit(ref lit) => Some(lit_to_constant(&lit.node)),
271-
ExprVec(ref vec) => self.multi(vec).map(Constant::Vec),
271+
ExprArray(ref vec) => self.multi(vec).map(Constant::Vec),
272272
ExprTup(ref tup) => self.multi(tup).map(Constant::Tuple),
273273
ExprRepeat(ref value, ref number) => {
274274
self.binop_apply(value, number, |v, n| Some(Constant::Repeat(Box::new(v), n.as_u64() as usize)))

clippy_lints/src/copies.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -265,7 +265,7 @@ fn bindings<'a, 'tcx>(cx: &LateContext<'a, 'tcx>, pat: &Pat) -> HashMap<Interned
265265
bindings_impl(cx, pat, map);
266266
}
267267
}
268-
PatKind::Vec(ref lhs, ref mid, ref rhs) => {
268+
PatKind::Slice(ref lhs, ref mid, ref rhs) => {
269269
for pat in lhs {
270270
bindings_impl(cx, pat, map);
271271
}

clippy_lints/src/eval_order_dependence.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -213,7 +213,7 @@ fn check_expr<'v, 't>(vis: & mut ReadVisitor<'v, 't>, expr: &'v Expr) -> StopEar
213213
}
214214

215215
match expr.node {
216-
ExprVec(_) |
216+
ExprArray(_) |
217217
ExprTup(_) |
218218
ExprMethodCall(_, _, _) |
219219
ExprCall(_, _) |

clippy_lints/src/format.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,7 @@ pub fn get_argument_fmtstr_parts<'a, 'b>(cx: &LateContext<'a, 'b>, expr: &'a Exp
8282
decl.name.as_str() == "__STATIC_FMTSTR",
8383
let ItemStatic(_, _, ref expr) = decl.node,
8484
let ExprAddrOf(_, ref expr) = expr.node, // &[""]
85-
let ExprVec(ref exprs) = expr.node,
85+
let ExprArray(ref exprs) = expr.node,
8686
], {
8787
let mut result = Vec::new();
8888
for expr in exprs {
@@ -123,7 +123,7 @@ fn check_arg_is_display(cx: &LateContext, expr: &Expr) -> bool {
123123
arms[0].pats.len() == 1,
124124
let PatKind::Tuple(ref pat, None) = arms[0].pats[0].node,
125125
pat.len() == 1,
126-
let ExprVec(ref exprs) = arms[0].body.node,
126+
let ExprArray(ref exprs) = arms[0].body.node,
127127
exprs.len() == 1,
128128
let ExprCall(_, ref args) = exprs[0].node,
129129
args.len() == 2,

clippy_lints/src/no_effect.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ fn has_no_effect(cx: &LateContext, expr: &Expr) -> bool {
5050
Expr_::ExprPath(..) => true,
5151
Expr_::ExprIndex(ref a, ref b) |
5252
Expr_::ExprBinary(_, ref a, ref b) => has_no_effect(cx, a) && has_no_effect(cx, b),
53-
Expr_::ExprVec(ref v) |
53+
Expr_::ExprArray(ref v) |
5454
Expr_::ExprTup(ref v) => v.iter().all(|val| has_no_effect(cx, val)),
5555
Expr_::ExprRepeat(ref inner, _) |
5656
Expr_::ExprCast(ref inner, _) |
@@ -130,7 +130,7 @@ fn reduce_expression<'a>(cx: &LateContext, expr: &'a Expr) -> Option<Vec<&'a Exp
130130
match expr.node {
131131
Expr_::ExprIndex(ref a, ref b) |
132132
Expr_::ExprBinary(_, ref a, ref b) => Some(vec![&**a, &**b]),
133-
Expr_::ExprVec(ref v) |
133+
Expr_::ExprArray(ref v) |
134134
Expr_::ExprTup(ref v) => Some(v.iter().map(Deref::deref).collect()),
135135
Expr_::ExprRepeat(ref inner, _) |
136136
Expr_::ExprCast(ref inner, _) |

clippy_lints/src/regex.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -190,7 +190,7 @@ fn is_trivial_regex(s: &regex_syntax::Expr) -> Option<&'static str> {
190190
fn check_set(cx: &LateContext, expr: &Expr, utf8: bool) {
191191
if_let_chain! {[
192192
let ExprAddrOf(_, ref expr) = expr.node,
193-
let ExprVec(ref exprs) = expr.node,
193+
let ExprArray(ref exprs) = expr.node,
194194
], {
195195
for expr in exprs {
196196
check_regex(cx, expr, utf8);

clippy_lints/src/shadow.rs

+3-3
Original file line numberDiff line numberDiff line change
@@ -281,7 +281,7 @@ fn check_expr(cx: &LateContext, expr: &Expr, bindings: &mut Vec<(Name, Span)>) {
281281
ExprLoop(ref block, _) => check_block(cx, block, bindings),
282282
// ExprCall
283283
// ExprMethodCall
284-
ExprVec(ref v) | ExprTup(ref v) => {
284+
ExprArray(ref v) | ExprTup(ref v) => {
285285
for e in v {
286286
check_expr(cx, e, bindings)
287287
}
@@ -319,8 +319,8 @@ fn check_expr(cx: &LateContext, expr: &Expr, bindings: &mut Vec<(Name, Span)>) {
319319
fn check_ty(cx: &LateContext, ty: &Ty, bindings: &mut Vec<(Name, Span)>) {
320320
match ty.node {
321321
TyObjectSum(ref sty, _) |
322-
TyVec(ref sty) => check_ty(cx, sty, bindings),
323-
TyFixedLengthVec(ref fty, ref expr) => {
322+
TySlice(ref sty) => check_ty(cx, sty, bindings),
323+
TyArray(ref fty, ref expr) => {
324324
check_ty(cx, fty, bindings);
325325
check_expr(cx, expr, bindings);
326326
}

clippy_lints/src/types.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -627,9 +627,9 @@ impl<'v> Visitor<'v> for TypeComplexityVisitor {
627627

628628
// the "normal" components of a type: named types, arrays/tuples
629629
TyPath(..) |
630-
TyVec(..) |
630+
TySlice(..) |
631631
TyTup(..) |
632-
TyFixedLengthVec(..) => (10 * self.nest, 1),
632+
TyArray(..) => (10 * self.nest, 1),
633633

634634
// "Sum" of trait bounds
635635
TyObjectSum(..) => (20 * self.nest, 0),

clippy_lints/src/utils/higher.rs

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

clippy_lints/src/utils/hir.rs

+6-6
Original file line numberDiff line numberDiff line change
@@ -122,7 +122,7 @@ impl<'a, 'tcx: 'a> SpanlessEq<'a, 'tcx> {
122122
(&ExprTup(ref l_tup), &ExprTup(ref r_tup)) => self.eq_exprs(l_tup, r_tup),
123123
(&ExprTupField(ref le, li), &ExprTupField(ref re, ri)) => li.node == ri.node && self.eq_expr(le, re),
124124
(&ExprUnary(l_op, ref le), &ExprUnary(r_op, ref re)) => l_op == r_op && self.eq_expr(le, re),
125-
(&ExprVec(ref l), &ExprVec(ref r)) => self.eq_exprs(l, r),
125+
(&ExprArray(ref l), &ExprArray(ref r)) => self.eq_exprs(l, r),
126126
(&ExprWhile(ref lc, ref lb, ref ll), &ExprWhile(ref rc, ref rb, ref rl)) => {
127127
self.eq_expr(lc, rc) && self.eq_block(lb, rb) && both(ll, rl, |l, r| l.node.as_str() == r.node.as_str())
128128
}
@@ -159,7 +159,7 @@ impl<'a, 'tcx: 'a> SpanlessEq<'a, 'tcx> {
159159
self.eq_expr(ls, rs) && self.eq_expr(le, re)
160160
}
161161
(&PatKind::Ref(ref le, ref lm), &PatKind::Ref(ref re, ref rm)) => lm == rm && self.eq_pat(le, re),
162-
(&PatKind::Vec(ref ls, ref li, ref le), &PatKind::Vec(ref rs, ref ri, ref re)) => {
162+
(&PatKind::Slice(ref ls, ref li, ref le), &PatKind::Slice(ref rs, ref ri, ref re)) => {
163163
over(ls, rs, |l, r| self.eq_pat(l, r)) && over(le, re, |l, r| self.eq_pat(l, r)) &&
164164
both(li, ri, |l, r| self.eq_pat(l, r))
165165
}
@@ -183,8 +183,8 @@ impl<'a, 'tcx: 'a> SpanlessEq<'a, 'tcx> {
183183

184184
fn eq_ty(&self, left: &Ty, right: &Ty) -> bool {
185185
match (&left.node, &right.node) {
186-
(&TyVec(ref l_vec), &TyVec(ref r_vec)) => self.eq_ty(l_vec, r_vec),
187-
(&TyFixedLengthVec(ref lt, ref ll), &TyFixedLengthVec(ref rt, ref rl)) => {
186+
(&TySlice(ref l_vec), &TySlice(ref r_vec)) => self.eq_ty(l_vec, r_vec),
187+
(&TyArray(ref lt, ref ll), &TyArray(ref rt, ref rl)) => {
188188
self.eq_ty(lt, rt) && self.eq_expr(ll, rl)
189189
}
190190
(&TyPtr(ref l_mut), &TyPtr(ref r_mut)) => l_mut.mutbl == r_mut.mutbl && self.eq_ty(&*l_mut.ty, &*r_mut.ty),
@@ -457,8 +457,8 @@ impl<'a, 'tcx: 'a> SpanlessHash<'a, 'tcx> {
457457
lop.hash(&mut self.s);
458458
self.hash_expr(le);
459459
}
460-
ExprVec(ref v) => {
461-
let c: fn(_) -> _ = ExprVec;
460+
ExprArray(ref v) => {
461+
let c: fn(_) -> _ = ExprArray;
462462
c.hash(&mut self.s);
463463

464464
self.hash_exprs(v);

clippy_lints/src/utils/mod.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -750,7 +750,7 @@ pub fn is_refutable(cx: &LateContext, pat: &Pat) -> bool {
750750
are_refutable(cx, pats.iter().map(|pat| &**pat))
751751
}
752752
}
753-
PatKind::Vec(ref head, ref middle, ref tail) => {
753+
PatKind::Slice(ref head, ref middle, ref tail) => {
754754
are_refutable(cx, head.iter().chain(middle).chain(tail.iter()).map(|pat| &**pat))
755755
}
756756
}

clippy_lints/src/utils/sugg.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,7 @@ impl<'a> Sugg<'a> {
5050
hir::ExprUnary(..) |
5151
hir::ExprMatch(..) => Sugg::MaybeParen(snippet),
5252
hir::ExprAgain(..) |
53+
hir::ExprArray(..) |
5354
hir::ExprBlock(..) |
5455
hir::ExprBreak(..) |
5556
hir::ExprCall(..) |
@@ -65,7 +66,6 @@ impl<'a> Sugg<'a> {
6566
hir::ExprStruct(..) |
6667
hir::ExprTup(..) |
6768
hir::ExprTupField(..) |
68-
hir::ExprVec(..) |
6969
hir::ExprWhile(..) => Sugg::NonParen(snippet),
7070
hir::ExprAssign(..) => Sugg::BinOp(AssocOp::Assign, snippet),
7171
hir::ExprAssignOp(op, ..) => Sugg::BinOp(hirbinop2assignop(op), snippet),

0 commit comments

Comments
 (0)