We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent c39ca24 commit 7fb99b4Copy full SHA for 7fb99b4
clippy_lints/src/array_indexing.rs
@@ -1,10 +1,10 @@
1
use rustc::lint::*;
2
use rustc::middle::const_val::ConstVal;
3
-use rustc::ty::TyArray;
+use rustc::ty;
4
use rustc_const_eval::EvalHint::ExprTypeChecked;
5
use rustc_const_eval::eval_const_expr_partial;
6
use rustc_const_math::ConstInt;
7
-use rustc::hir::*;
+use rustc::hir;
8
use syntax::ast::RangeLimits;
9
use utils::{self, higher};
10
@@ -56,11 +56,11 @@ impl LintPass for ArrayIndexing {
56
}
57
58
impl LateLintPass for ArrayIndexing {
59
- fn check_expr(&mut self, cx: &LateContext, e: &Expr) {
60
- 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 {
61
// Array with known size can be checked statically
62
let ty = cx.tcx.expr_ty(array);
63
- if let TyArray(_, size) = ty.sty {
+ if let ty::TyArray(_, size) = ty.sty {
64
let size = ConstInt::Infer(size as u64);
65
66
// Index is a constant uint
clippy_lints/src/consts.rs
@@ -268,7 +268,7 @@ impl<'c, 'cc> ConstEvalLateContext<'c, 'cc> {
268
ExprBlock(ref block) => self.block(block),
269
ExprIf(ref cond, ref then, ref otherwise) => self.ifthenelse(cond, then, otherwise),
270
ExprLit(ref lit) => Some(lit_to_constant(&lit.node)),
271
- ExprVec(ref vec) => self.multi(vec).map(Constant::Vec),
+ ExprArray(ref vec) => self.multi(vec).map(Constant::Vec),
272
ExprTup(ref tup) => self.multi(tup).map(Constant::Tuple),
273
ExprRepeat(ref value, ref number) => {
274
self.binop_apply(value, number, |v, n| Some(Constant::Repeat(Box::new(v), n.as_u64() as usize)))
clippy_lints/src/copies.rs
@@ -265,7 +265,7 @@ fn bindings<'a, 'tcx>(cx: &LateContext<'a, 'tcx>, pat: &Pat) -> HashMap<Interned
265
bindings_impl(cx, pat, map);
266
267
- PatKind::Vec(ref lhs, ref mid, ref rhs) => {
+ PatKind::Slice(ref lhs, ref mid, ref rhs) => {
for pat in lhs {
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
213
214
215
match expr.node {
216
- ExprVec(_) |
+ ExprArray(_) |
217
ExprTup(_) |
218
ExprMethodCall(_, _, _) |
219
ExprCall(_, _) |
clippy_lints/src/format.rs
@@ -82,7 +82,7 @@ pub fn get_argument_fmtstr_parts<'a, 'b>(cx: &LateContext<'a, 'b>, expr: &'a Exp
82
decl.name.as_str() == "__STATIC_FMTSTR",
83
let ItemStatic(_, _, ref expr) = decl.node,
84
let ExprAddrOf(_, ref expr) = expr.node, // &[""]
85
- let ExprVec(ref exprs) = expr.node,
+ let ExprArray(ref exprs) = expr.node,
86
], {
87
let mut result = Vec::new();
88
for expr in exprs {
@@ -123,7 +123,7 @@ fn check_arg_is_display(cx: &LateContext, expr: &Expr) -> bool {
123
arms[0].pats.len() == 1,
124
let PatKind::Tuple(ref pat, None) = arms[0].pats[0].node,
125
pat.len() == 1,
126
- let ExprVec(ref exprs) = arms[0].body.node,
+ let ExprArray(ref exprs) = arms[0].body.node,
127
exprs.len() == 1,
128
let ExprCall(_, ref args) = exprs[0].node,
129
args.len() == 2,
clippy_lints/src/no_effect.rs
@@ -50,7 +50,7 @@ fn has_no_effect(cx: &LateContext, expr: &Expr) -> bool {
50
Expr_::ExprPath(..) => true,
51
Expr_::ExprIndex(ref a, ref b) |
52
Expr_::ExprBinary(_, ref a, ref b) => has_no_effect(cx, a) && has_no_effect(cx, b),
53
- Expr_::ExprVec(ref v) |
+ Expr_::ExprArray(ref v) |
54
Expr_::ExprTup(ref v) => v.iter().all(|val| has_no_effect(cx, val)),
55
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
130
131
132
Expr_::ExprBinary(_, ref a, ref b) => Some(vec![&**a, &**b]),
133
134
Expr_::ExprTup(ref v) => Some(v.iter().map(Deref::deref).collect()),
135
136
clippy_lints/src/regex.rs
@@ -190,7 +190,7 @@ fn is_trivial_regex(s: ®ex_syntax::Expr) -> Option<&'static str> {
190
fn check_set(cx: &LateContext, expr: &Expr, utf8: bool) {
191
if_let_chain! {[
192
let ExprAddrOf(_, ref expr) = expr.node,
193
194
195
196
check_regex(cx, expr, utf8);
clippy_lints/src/shadow.rs
@@ -281,7 +281,7 @@ fn check_expr(cx: &LateContext, expr: &Expr, bindings: &mut Vec<(Name, Span)>) {
281
ExprLoop(ref block, _) => check_block(cx, block, bindings),
282
// ExprCall
283
// ExprMethodCall
284
- ExprVec(ref v) | ExprTup(ref v) => {
+ ExprArray(ref v) | ExprTup(ref v) => {
285
for e in v {
286
check_expr(cx, e, bindings)
287
@@ -319,8 +319,8 @@ fn check_expr(cx: &LateContext, expr: &Expr, bindings: &mut Vec<(Name, Span)>) {
319
fn check_ty(cx: &LateContext, ty: &Ty, bindings: &mut Vec<(Name, Span)>) {
320
match ty.node {
321
TyObjectSum(ref sty, _) |
322
- TyVec(ref sty) => check_ty(cx, sty, bindings),
323
- TyFixedLengthVec(ref fty, ref expr) => {
+ TySlice(ref sty) => check_ty(cx, sty, bindings),
+ TyArray(ref fty, ref expr) => {
324
check_ty(cx, fty, bindings);
325
check_expr(cx, expr, bindings);
326
clippy_lints/src/types.rs
@@ -627,9 +627,9 @@ impl<'v> Visitor<'v> for TypeComplexityVisitor {
627
628
// the "normal" components of a type: named types, arrays/tuples
629
TyPath(..) |
630
- TyVec(..) |
+ TySlice(..) |
631
TyTup(..) |
632
- TyFixedLengthVec(..) => (10 * self.nest, 1),
+ TyArray(..) => (10 * self.nest, 1),
633
634
// "Sum" of trait bounds
635
TyObjectSum(..) => (20 * self.nest, 0),
clippy_lints/src/utils/higher.rs
@@ -180,7 +180,7 @@ pub fn vec_macro<'e>(cx: &LateContext, expr: &'e hir::Expr) -> Option<VecArgs<'e
180
// `vec![a, b, c]` case
181
if_let_chain!{[
182
let hir::ExprBox(ref boxed) = args[0].node,
183
- let hir::ExprVec(ref args) = boxed.node
+ let hir::ExprArray(ref args) = boxed.node
184
185
return Some(VecArgs::Vec(&*args));
186
}}
0 commit comments