blob: d5b5455343e43dad0964762672305ca04264aa72 [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 | 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)]`
help: provide the highest index that is indexed with
|
LL - assert!(v.len() < 5);
LL + assert!(v.len() > 4);
|
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 | v[0] + v[1] + v[2] + v[3] + v[4]
| ^^^^ ^^^^ ^^^^ ^^^^ ^^^^
|
help: provide the highest index that is indexed with
|
LL - assert!(v.len() <= 5);
LL + assert!(v.len() > 4);
|
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 | v[0] + v[1] + v[2] + v[3] + v[4]
| ^^^^ ^^^^ ^^^^ ^^^^ ^^^^
|
help: provide the highest index that is indexed with
|
LL - assert!(v.len() > 3);
LL + assert!(v.len() > 4);
|
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 | v[0] + v[1] + v[2] + v[3] + v[4]
| ^^^^ ^^^^ ^^^^ ^^^^ ^^^^
|
help: provide the highest index that is indexed with
|
LL - assert!(v.len() >= 4);
LL + assert!(v.len() > 4);
|
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 | let _ = v[0];
| ^^^^
...
LL | let _ = v[1..4];
| ^^^^^^^
|
help: provide the highest index that is indexed with
|
LL - assert!(v.len() >= 3);
LL + assert!(v.len() > 3);
|
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 | let _ = v[0];
| ^^^^
...
LL | let _ = v[1..=4];
| ^^^^^^^^
|
help: provide the highest index that is indexed with
|
LL - assert!(v.len() >= 4);
LL + assert!(v.len() > 4);
|
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 | let _ = v1[0] + v1[12];
| ^^^^^ ^^^^^^
|
help: provide the highest index that is indexed with
|
LL - assert!(v1.len() >= 12);
LL + assert!(v1.len() > 12);
|
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 | let _ = v2[5] + v2[15];
| ^^^^^ ^^^^^^
|
help: provide the highest index that is indexed with
|
LL - assert!(v2.len() >= 15);
LL + assert!(v2.len() > 15);
|
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 | let _ = v1[0] + v1[12];
| ^^^^^ ^^^^^^
|
help: provide the highest index that is indexed with
|
LL - assert!(v1.len() >= 12);
LL + assert!(v1.len() > 12);
|
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 | let _ = v1[0] + v1[1] + v1[2];
| ^^^^^ ^^^^^ ^^^^^
|
help: provide the highest index that is indexed with
|
LL - assert!(v1.len() == 2);
LL + assert!(v1.len() == 3);
|
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 | let _ = v3[0] + v3[1] + v3[2];
| ^^^^^ ^^^^^ ^^^^^
|
help: provide the highest index that is indexed with
|
LL - assert!(2 == v3.len());
LL + assert!(v3.len() == 3);
|
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 | let _ = v1[0] + v1[1] + v1[2];
| ^^^^^ ^^^^^ ^^^^^
|
help: provide the highest index that is indexed with
|
LL - assert_eq!(v1.len(), 2);
LL + assert_eq!(v1.len(), 3);
|
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 | let _ = v3[0] + v3[1] + v3[2];
| ^^^^^ ^^^^^ ^^^^^
|
help: provide the highest index that is indexed with
|
LL - assert_eq!(2, v3.len());
LL + assert_eq!(v3.len(), 3);
|
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 | let _ = v[0] + v[1] + v[2];
| ^^^^ ^^^^ ^^^^
|
help: provide the highest index that is indexed with
|
LL - assert_eq!(v.len(), 2);
LL + assert_eq!(v.len(), 3);
|
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 | let _ = v[0] + v[1] + v[2];
| ^^^^ ^^^^ ^^^^
|
help: provide the highest index that is indexed with
|
LL - debug_assert_eq!(v.len(), 2);
LL + debug_assert_eq!(v.len(), 3);
|
error: aborting due to 15 previous errors