rust-clippy/tests/ui/missing_asserts_for_indexing.stderr

252 lines
8.4 KiB
Text

error: indexing into a slice multiple times with an `assert` that does not cover the highest index
--> $DIR/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
--> $DIR/missing_asserts_for_indexing.rs:30:5
|
LL | v[0] + v[1] + v[2] + v[3] + v[4]
| ^^^^
note: slice indexed here
--> $DIR/missing_asserts_for_indexing.rs:30:12
|
LL | v[0] + v[1] + v[2] + v[3] + v[4]
| ^^^^
note: slice indexed here
--> $DIR/missing_asserts_for_indexing.rs:30:19
|
LL | v[0] + v[1] + v[2] + v[3] + v[4]
| ^^^^
note: slice indexed here
--> $DIR/missing_asserts_for_indexing.rs:30:26
|
LL | v[0] + v[1] + v[2] + v[3] + v[4]
| ^^^^
note: slice indexed here
--> $DIR/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`
error: indexing into a slice multiple times with an `assert` that does not cover the highest index
--> $DIR/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
--> $DIR/missing_asserts_for_indexing.rs:36:5
|
LL | v[0] + v[1] + v[2] + v[3] + v[4]
| ^^^^
note: slice indexed here
--> $DIR/missing_asserts_for_indexing.rs:36:12
|
LL | v[0] + v[1] + v[2] + v[3] + v[4]
| ^^^^
note: slice indexed here
--> $DIR/missing_asserts_for_indexing.rs:36:19
|
LL | v[0] + v[1] + v[2] + v[3] + v[4]
| ^^^^
note: slice indexed here
--> $DIR/missing_asserts_for_indexing.rs:36:26
|
LL | v[0] + v[1] + v[2] + v[3] + v[4]
| ^^^^
note: slice indexed here
--> $DIR/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
--> $DIR/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
--> $DIR/missing_asserts_for_indexing.rs:42:5
|
LL | v[0] + v[1] + v[2] + v[3] + v[4]
| ^^^^
note: slice indexed here
--> $DIR/missing_asserts_for_indexing.rs:42:12
|
LL | v[0] + v[1] + v[2] + v[3] + v[4]
| ^^^^
note: slice indexed here
--> $DIR/missing_asserts_for_indexing.rs:42:19
|
LL | v[0] + v[1] + v[2] + v[3] + v[4]
| ^^^^
note: slice indexed here
--> $DIR/missing_asserts_for_indexing.rs:42:26
|
LL | v[0] + v[1] + v[2] + v[3] + v[4]
| ^^^^
note: slice indexed here
--> $DIR/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
--> $DIR/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
--> $DIR/missing_asserts_for_indexing.rs:48:5
|
LL | v[0] + v[1] + v[2] + v[3] + v[4]
| ^^^^
note: slice indexed here
--> $DIR/missing_asserts_for_indexing.rs:48:12
|
LL | v[0] + v[1] + v[2] + v[3] + v[4]
| ^^^^
note: slice indexed here
--> $DIR/missing_asserts_for_indexing.rs:48:19
|
LL | v[0] + v[1] + v[2] + v[3] + v[4]
| ^^^^
note: slice indexed here
--> $DIR/missing_asserts_for_indexing.rs:48:26
|
LL | v[0] + v[1] + v[2] + v[3] + v[4]
| ^^^^
note: slice indexed here
--> $DIR/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
--> $DIR/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 | |
LL | | let _ = v[1..4];
| |___________________^
|
note: slice indexed here
--> $DIR/missing_asserts_for_indexing.rs:66:13
|
LL | let _ = v[0];
| ^^^^
note: slice indexed here
--> $DIR/missing_asserts_for_indexing.rs:68: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
--> $DIR/missing_asserts_for_indexing.rs:80:13
|
LL | assert!(v.len() >= 4);
| --------------------- help: provide the highest index that is indexed with: `assert!(v.len() > 4)`
LL | let _ = v[0];
| _____________^
LL | |
LL | | let _ = v[1..=4];
| |____________________^
|
note: slice indexed here
--> $DIR/missing_asserts_for_indexing.rs:80:13
|
LL | let _ = v[0];
| ^^^^
note: slice indexed here
--> $DIR/missing_asserts_for_indexing.rs:82: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
--> $DIR/missing_asserts_for_indexing.rs:95: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
--> $DIR/missing_asserts_for_indexing.rs:95:13
|
LL | let _ = v1[0] + v1[12];
| ^^^^^
note: slice indexed here
--> $DIR/missing_asserts_for_indexing.rs:95: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
--> $DIR/missing_asserts_for_indexing.rs:97: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
--> $DIR/missing_asserts_for_indexing.rs:97:13
|
LL | let _ = v2[5] + v2[15];
| ^^^^^
note: slice indexed here
--> $DIR/missing_asserts_for_indexing.rs:97: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
--> $DIR/missing_asserts_for_indexing.rs:103: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
--> $DIR/missing_asserts_for_indexing.rs:103:13
|
LL | let _ = v1[0] + v1[12];
| ^^^^^
note: slice indexed here
--> $DIR/missing_asserts_for_indexing.rs:103:21
|
LL | let _ = v1[0] + v1[12];
| ^^^^^^
= note: asserting the length before indexing will elide bounds checks
error: aborting due to 9 previous errors