]> git.lizzy.rs Git - rust.git/blobdiff - clippy_lints/src/array_indexing.rs
update to the rust-PR that unblocks clippy
[rust.git] / clippy_lints / src / array_indexing.rs
index d8d7c0285c02b944d3e0b63170200211f5623282..399f93d08c7cd419641f715efa4e534db03fe83b 100644 (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};
 
@@ -24,7 +24,7 @@
 declare_lint! {
     pub OUT_OF_BOUNDS_INDEXING,
     Deny,
-    "out of bound constant indexing"
+    "out of bounds constant indexing"
 }
 
 /// **What it does:** Checks for usage of indexing or slicing.
@@ -55,12 +55,12 @@ fn get_lints(&self) -> LintArray {
     }
 }
 
-impl LateLintPass for ArrayIndexing {
-    fn check_expr(&mut self, cx: &LateContext, e: &Expr) {
-        if let ExprIndex(ref array, ref index) = e.node {
+impl<'a, 'tcx> LateLintPass<'a, 'tcx> for ArrayIndexing {
+    fn check_expr(&mut self, cx: &LateContext<'a, 'tcx>, e: &'tcx 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 {
+            let ty = cx.tcx.tables().expr_ty(array);
+            if let ty::TyArray(_, size) = ty.sty {
                 let size = ConstInt::Infer(size as u64);
 
                 // Index is a constant uint