]> git.lizzy.rs Git - rust.git/blobdiff - clippy_lints/src/indexing_slicing.rs
Split out `infalliable_detructuring_match`
[rust.git] / clippy_lints / src / indexing_slicing.rs
index 8c1f107330955d71fae5bd47034954f087cae384..9ead4bb27a5881eb3ab43d6def4481f658999b44 100644 (file)
@@ -33,6 +33,7 @@
     /// x[0];
     /// x[3];
     /// ```
+    #[clippy::version = "pre 1.29.0"]
     pub OUT_OF_BOUNDS_INDEXING,
     correctness,
     "out of bounds constant indexing"
@@ -85,6 +86,7 @@
     /// y.get(10..);
     /// y.get(..100);
     /// ```
+    #[clippy::version = "pre 1.29.0"]
     pub INDEXING_SLICING,
     restriction,
     "indexing/slicing usage"
@@ -96,7 +98,7 @@ impl<'tcx> LateLintPass<'tcx> for IndexingSlicing {
     fn check_expr(&mut self, cx: &LateContext<'tcx>, expr: &'tcx Expr<'_>) {
         if let ExprKind::Index(array, index) = &expr.kind {
             let ty = cx.typeck_results().expr_ty(array).peel_refs();
-            if let Some(range) = higher::range(index) {
+            if let Some(range) = higher::Range::hir(index) {
                 // Ranged indexes, i.e., &x[n..m], &x[n..], &x[..n] and &x[..]
                 if let ty::Array(_, s) = ty.kind() {
                     let size: u128 = if let Some(size) = s.try_eval_usize(cx.tcx, cx.param_env) {