blob: b686eda7530a005f88d9ec9d9d1c5687a5068548 [file] [log] [blame]
error: indexing into a slice multiple times with an `assert` that does not cover the highest index
--> tests/ui/missing_asserts_for_indexing.rs:30:5
|
LL | assert!(v.len() < 5);
| -------------------- help: provide the highest index that is indexed with: `assert!(v.len() > 4)`
LL | v[0] + v[1] + v[2] + v[3] + v[4]
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
note: slice indexed here
--> tests/ui/missing_asserts_for_indexing.rs:30:5
|
LL | v[0] + v[1] + v[2] + v[3] + v[4]
| ^^^^
note: slice indexed here
--> tests/ui/missing_asserts_for_indexing.rs:30:12
|
LL | v[0] + v[1] + v[2] + v[3] + v[4]
| ^^^^
note: slice indexed here
--> tests/ui/missing_asserts_for_indexing.rs:30:19
|
LL | v[0] + v[1] + v[2] + v[3] + v[4]
| ^^^^
note: slice indexed here
--> tests/ui/missing_asserts_for_indexing.rs:30:26
|
LL | v[0] + v[1] + v[2] + v[3] + v[4]
| ^^^^
note: slice indexed here
--> tests/ui/missing_asserts_for_indexing.rs:30:33
|
LL | v[0] + v[1] + v[2] + v[3] + v[4]
| ^^^^
= note: asserting the length before indexing will elide bounds checks
= note: `-D clippy::missing-asserts-for-indexing` implied by `-D warnings`
= help: to override `-D warnings` add `#[allow(clippy::missing_asserts_for_indexing)]`
error: indexing into a slice multiple times with an `assert` that does not cover the highest index
--> tests/ui/missing_asserts_for_indexing.rs:36:5
|
LL | assert!(v.len() <= 5);
| --------------------- help: provide the highest index that is indexed with: `assert!(v.len() > 4)`
LL | v[0] + v[1] + v[2] + v[3] + v[4]
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
note: slice indexed here
--> tests/ui/missing_asserts_for_indexing.rs:36:5
|
LL | v[0] + v[1] + v[2] + v[3] + v[4]
| ^^^^
note: slice indexed here
--> tests/ui/missing_asserts_for_indexing.rs:36:12
|
LL | v[0] + v[1] + v[2] + v[3] + v[4]
| ^^^^
note: slice indexed here
--> tests/ui/missing_asserts_for_indexing.rs:36:19
|
LL | v[0] + v[1] + v[2] + v[3] + v[4]
| ^^^^
note: slice indexed here
--> tests/ui/missing_asserts_for_indexing.rs:36:26
|
LL | v[0] + v[1] + v[2] + v[3] + v[4]
| ^^^^
note: slice indexed here
--> tests/ui/missing_asserts_for_indexing.rs:36:33
|
LL | v[0] + v[1] + v[2] + v[3] + v[4]
| ^^^^
= note: asserting the length before indexing will elide bounds checks
error: indexing into a slice multiple times with an `assert` that does not cover the highest index
--> tests/ui/missing_asserts_for_indexing.rs:42:5
|
LL | assert!(v.len() > 3);
| -------------------- help: provide the highest index that is indexed with: `assert!(v.len() > 4)`
LL | v[0] + v[1] + v[2] + v[3] + v[4]
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
note: slice indexed here
--> tests/ui/missing_asserts_for_indexing.rs:42:5
|
LL | v[0] + v[1] + v[2] + v[3] + v[4]
| ^^^^
note: slice indexed here
--> tests/ui/missing_asserts_for_indexing.rs:42:12
|
LL | v[0] + v[1] + v[2] + v[3] + v[4]
| ^^^^
note: slice indexed here
--> tests/ui/missing_asserts_for_indexing.rs:42:19
|
LL | v[0] + v[1] + v[2] + v[3] + v[4]
| ^^^^
note: slice indexed here
--> tests/ui/missing_asserts_for_indexing.rs:42:26
|
LL | v[0] + v[1] + v[2] + v[3] + v[4]
| ^^^^
note: slice indexed here
--> tests/ui/missing_asserts_for_indexing.rs:42:33
|
LL | v[0] + v[1] + v[2] + v[3] + v[4]
| ^^^^
= note: asserting the length before indexing will elide bounds checks
error: indexing into a slice multiple times with an `assert` that does not cover the highest index
--> tests/ui/missing_asserts_for_indexing.rs:48:5
|
LL | assert!(v.len() >= 4);
| --------------------- help: provide the highest index that is indexed with: `assert!(v.len() > 4)`
LL | v[0] + v[1] + v[2] + v[3] + v[4]
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
note: slice indexed here
--> tests/ui/missing_asserts_for_indexing.rs:48:5
|
LL | v[0] + v[1] + v[2] + v[3] + v[4]
| ^^^^
note: slice indexed here
--> tests/ui/missing_asserts_for_indexing.rs:48:12
|
LL | v[0] + v[1] + v[2] + v[3] + v[4]
| ^^^^
note: slice indexed here
--> tests/ui/missing_asserts_for_indexing.rs:48:19
|
LL | v[0] + v[1] + v[2] + v[3] + v[4]
| ^^^^
note: slice indexed here
--> tests/ui/missing_asserts_for_indexing.rs:48:26
|
LL | v[0] + v[1] + v[2] + v[3] + v[4]
| ^^^^
note: slice indexed here
--> tests/ui/missing_asserts_for_indexing.rs:48:33
|
LL | v[0] + v[1] + v[2] + v[3] + v[4]
| ^^^^
= note: asserting the length before indexing will elide bounds checks
error: indexing into a slice multiple times with an `assert` that does not cover the highest index
--> tests/ui/missing_asserts_for_indexing.rs:66:13
|
LL | assert!(v.len() >= 3);
| --------------------- help: provide the highest index that is indexed with: `assert!(v.len() > 3)`
LL | let _ = v[0];
| _____________^
... |
LL | | let _ = v[1..4];
| |___________________^
|
note: slice indexed here
--> tests/ui/missing_asserts_for_indexing.rs:66:13
|
LL | let _ = v[0];
| ^^^^
note: slice indexed here
--> tests/ui/missing_asserts_for_indexing.rs:69:13
|
LL | let _ = v[1..4];
| ^^^^^^^
= note: asserting the length before indexing will elide bounds checks
error: indexing into a slice multiple times with an `assert` that does not cover the highest index
--> tests/ui/missing_asserts_for_indexing.rs:81:13
|
LL | assert!(v.len() >= 4);
| --------------------- help: provide the highest index that is indexed with: `assert!(v.len() > 4)`
LL | let _ = v[0];
| _____________^
... |
LL | | let _ = v[1..=4];
| |____________________^
|
note: slice indexed here
--> tests/ui/missing_asserts_for_indexing.rs:81:13
|
LL | let _ = v[0];
| ^^^^
note: slice indexed here
--> tests/ui/missing_asserts_for_indexing.rs:84:13
|
LL | let _ = v[1..=4];
| ^^^^^^^^
= note: asserting the length before indexing will elide bounds checks
error: indexing into a slice multiple times with an `assert` that does not cover the highest index
--> tests/ui/missing_asserts_for_indexing.rs:97:13
|
LL | assert!(v1.len() >= 12);
| ----------------------- help: provide the highest index that is indexed with: `assert!(v1.len() > 12)`
LL | assert!(v2.len() >= 15);
LL | let _ = v1[0] + v1[12];
| ^^^^^^^^^^^^^^
|
note: slice indexed here
--> tests/ui/missing_asserts_for_indexing.rs:97:13
|
LL | let _ = v1[0] + v1[12];
| ^^^^^
note: slice indexed here
--> tests/ui/missing_asserts_for_indexing.rs:97:21
|
LL | let _ = v1[0] + v1[12];
| ^^^^^^
= note: asserting the length before indexing will elide bounds checks
error: indexing into a slice multiple times with an `assert` that does not cover the highest index
--> tests/ui/missing_asserts_for_indexing.rs:100:13
|
LL | assert!(v2.len() >= 15);
| ----------------------- help: provide the highest index that is indexed with: `assert!(v2.len() > 15)`
...
LL | let _ = v2[5] + v2[15];
| ^^^^^^^^^^^^^^
|
note: slice indexed here
--> tests/ui/missing_asserts_for_indexing.rs:100:13
|
LL | let _ = v2[5] + v2[15];
| ^^^^^
note: slice indexed here
--> tests/ui/missing_asserts_for_indexing.rs:100:21
|
LL | let _ = v2[5] + v2[15];
| ^^^^^^
= note: asserting the length before indexing will elide bounds checks
error: indexing into a slice multiple times with an `assert` that does not cover the highest index
--> tests/ui/missing_asserts_for_indexing.rs:106:13
|
LL | assert!(v1.len() >= 12);
| ----------------------- help: provide the highest index that is indexed with: `assert!(v1.len() > 12)`
LL | assert!(v2.len() > 15);
LL | let _ = v1[0] + v1[12];
| ^^^^^^^^^^^^^^
|
note: slice indexed here
--> tests/ui/missing_asserts_for_indexing.rs:106:13
|
LL | let _ = v1[0] + v1[12];
| ^^^^^
note: slice indexed here
--> tests/ui/missing_asserts_for_indexing.rs:106:21
|
LL | let _ = v1[0] + v1[12];
| ^^^^^^
= note: asserting the length before indexing will elide bounds checks
error: indexing into a slice multiple times with an `assert` that does not cover the highest index
--> tests/ui/missing_asserts_for_indexing.rs:131:13
|
LL | assert!(v1.len() == 2);
| ---------------------- help: provide the highest index that is indexed with: `assert!(v1.len() == 3)`
...
LL | let _ = v1[0] + v1[1] + v1[2];
| ^^^^^^^^^^^^^^^^^^^^^
|
note: slice indexed here
--> tests/ui/missing_asserts_for_indexing.rs:131:13
|
LL | let _ = v1[0] + v1[1] + v1[2];
| ^^^^^
note: slice indexed here
--> tests/ui/missing_asserts_for_indexing.rs:131:21
|
LL | let _ = v1[0] + v1[1] + v1[2];
| ^^^^^
note: slice indexed here
--> tests/ui/missing_asserts_for_indexing.rs:131:29
|
LL | let _ = v1[0] + v1[1] + v1[2];
| ^^^^^
= note: asserting the length before indexing will elide bounds checks
error: indexing into a slice multiple times with an `assert` that does not cover the highest index
--> tests/ui/missing_asserts_for_indexing.rs:136:13
|
LL | assert!(2 == v3.len());
| ---------------------- help: provide the highest index that is indexed with: `assert!(v3.len() == 3)`
...
LL | let _ = v3[0] + v3[1] + v3[2];
| ^^^^^^^^^^^^^^^^^^^^^
|
note: slice indexed here
--> tests/ui/missing_asserts_for_indexing.rs:136:13
|
LL | let _ = v3[0] + v3[1] + v3[2];
| ^^^^^
note: slice indexed here
--> tests/ui/missing_asserts_for_indexing.rs:136:21
|
LL | let _ = v3[0] + v3[1] + v3[2];
| ^^^^^
note: slice indexed here
--> tests/ui/missing_asserts_for_indexing.rs:136:29
|
LL | let _ = v3[0] + v3[1] + v3[2];
| ^^^^^
= note: asserting the length before indexing will elide bounds checks
error: indexing into a slice multiple times with an `assert` that does not cover the highest index
--> tests/ui/missing_asserts_for_indexing.rs:158:13
|
LL | assert_eq!(v1.len(), 2);
| ----------------------- help: provide the highest index that is indexed with: `assert_eq!(v1.len(), 3)`
...
LL | let _ = v1[0] + v1[1] + v1[2];
| ^^^^^^^^^^^^^^^^^^^^^
|
note: slice indexed here
--> tests/ui/missing_asserts_for_indexing.rs:158:13
|
LL | let _ = v1[0] + v1[1] + v1[2];
| ^^^^^
note: slice indexed here
--> tests/ui/missing_asserts_for_indexing.rs:158:21
|
LL | let _ = v1[0] + v1[1] + v1[2];
| ^^^^^
note: slice indexed here
--> tests/ui/missing_asserts_for_indexing.rs:158:29
|
LL | let _ = v1[0] + v1[1] + v1[2];
| ^^^^^
= note: asserting the length before indexing will elide bounds checks
error: indexing into a slice multiple times with an `assert` that does not cover the highest index
--> tests/ui/missing_asserts_for_indexing.rs:163:13
|
LL | assert_eq!(2, v3.len());
| ----------------------- help: provide the highest index that is indexed with: `assert_eq!(v3.len(), 3)`
...
LL | let _ = v3[0] + v3[1] + v3[2];
| ^^^^^^^^^^^^^^^^^^^^^
|
note: slice indexed here
--> tests/ui/missing_asserts_for_indexing.rs:163:13
|
LL | let _ = v3[0] + v3[1] + v3[2];
| ^^^^^
note: slice indexed here
--> tests/ui/missing_asserts_for_indexing.rs:163:21
|
LL | let _ = v3[0] + v3[1] + v3[2];
| ^^^^^
note: slice indexed here
--> tests/ui/missing_asserts_for_indexing.rs:163:29
|
LL | let _ = v3[0] + v3[1] + v3[2];
| ^^^^^
= note: asserting the length before indexing will elide bounds checks
error: indexing into a slice multiple times with an `assert` that does not cover the highest index
--> tests/ui/missing_asserts_for_indexing.rs:172:17
|
LL | assert_eq!(v.len(), 2);
| ---------------------- help: provide the highest index that is indexed with: `assert_eq!(v.len(), 3)`
LL | let _ = v[0] + v[1] + v[2];
| ^^^^^^^^^^^^^^^^^^
|
note: slice indexed here
--> tests/ui/missing_asserts_for_indexing.rs:172:17
|
LL | let _ = v[0] + v[1] + v[2];
| ^^^^
note: slice indexed here
--> tests/ui/missing_asserts_for_indexing.rs:172:24
|
LL | let _ = v[0] + v[1] + v[2];
| ^^^^
note: slice indexed here
--> tests/ui/missing_asserts_for_indexing.rs:172:31
|
LL | let _ = v[0] + v[1] + v[2];
| ^^^^
= note: asserting the length before indexing will elide bounds checks
error: indexing into a slice multiple times with an `assert` that does not cover the highest index
--> tests/ui/missing_asserts_for_indexing.rs:178:17
|
LL | debug_assert_eq!(v.len(), 2);
| ---------------------------- help: provide the highest index that is indexed with: `debug_assert_eq!(v.len(), 3)`
LL | let _ = v[0] + v[1] + v[2];
| ^^^^^^^^^^^^^^^^^^
|
note: slice indexed here
--> tests/ui/missing_asserts_for_indexing.rs:178:17
|
LL | let _ = v[0] + v[1] + v[2];
| ^^^^
note: slice indexed here
--> tests/ui/missing_asserts_for_indexing.rs:178:24
|
LL | let _ = v[0] + v[1] + v[2];
| ^^^^
note: slice indexed here
--> tests/ui/missing_asserts_for_indexing.rs:178:31
|
LL | let _ = v[0] + v[1] + v[2];
| ^^^^
= note: asserting the length before indexing will elide bounds checks
error: aborting due to 15 previous errors