2023-04-21 21:58:55 +00:00
|
|
|
error: indexing into a slice multiple times without an `assert`
|
2023-08-31 16:42:27 +00:00
|
|
|
--> $DIR/missing_asserts_for_indexing_unfixable.rs:5:5
|
2023-04-21 21:58:55 +00:00
|
|
|
|
|
|
|
|
LL | v[0] + v[1] + v[2] + v[3] + v[4]
|
|
|
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
|
|
|
|
|
|
|
|
= help: consider asserting the length before indexing: `assert!(v.len() > 4);`
|
|
|
|
note: slice indexed here
|
2023-08-31 16:42:27 +00:00
|
|
|
--> $DIR/missing_asserts_for_indexing_unfixable.rs:5:5
|
2023-04-21 21:58:55 +00:00
|
|
|
|
|
|
|
|
LL | v[0] + v[1] + v[2] + v[3] + v[4]
|
|
|
|
| ^^^^
|
|
|
|
note: slice indexed here
|
2023-08-31 16:42:27 +00:00
|
|
|
--> $DIR/missing_asserts_for_indexing_unfixable.rs:5:12
|
2023-04-21 21:58:55 +00:00
|
|
|
|
|
|
|
|
LL | v[0] + v[1] + v[2] + v[3] + v[4]
|
|
|
|
| ^^^^
|
|
|
|
note: slice indexed here
|
2023-08-31 16:42:27 +00:00
|
|
|
--> $DIR/missing_asserts_for_indexing_unfixable.rs:5:19
|
2023-04-21 21:58:55 +00:00
|
|
|
|
|
|
|
|
LL | v[0] + v[1] + v[2] + v[3] + v[4]
|
|
|
|
| ^^^^
|
|
|
|
note: slice indexed here
|
2023-08-31 16:42:27 +00:00
|
|
|
--> $DIR/missing_asserts_for_indexing_unfixable.rs:5:26
|
2023-04-21 21:58:55 +00:00
|
|
|
|
|
|
|
|
LL | v[0] + v[1] + v[2] + v[3] + v[4]
|
|
|
|
| ^^^^
|
|
|
|
note: slice indexed here
|
2023-08-31 16:42:27 +00:00
|
|
|
--> $DIR/missing_asserts_for_indexing_unfixable.rs:5:33
|
2023-04-21 21:58:55 +00:00
|
|
|
|
|
|
|
|
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`
|
2023-09-07 19:43:06 +00:00
|
|
|
= help: to override `-D warnings` add `#[allow(clippy::missing_asserts_for_indexing)]`
|
2023-04-21 21:58:55 +00:00
|
|
|
|
|
|
|
error: indexing into a slice multiple times without an `assert`
|
2023-08-31 16:42:27 +00:00
|
|
|
--> $DIR/missing_asserts_for_indexing_unfixable.rs:10:13
|
2023-04-21 21:58:55 +00:00
|
|
|
|
|
|
|
|
LL | let _ = v[0];
|
|
|
|
| _____________^
|
2023-08-31 16:42:27 +00:00
|
|
|
LL | |
|
2023-04-21 21:58:55 +00:00
|
|
|
LL | | let _ = v[1..4];
|
|
|
|
| |___________________^
|
|
|
|
|
|
|
|
|
= help: consider asserting the length before indexing: `assert!(v.len() > 3);`
|
|
|
|
note: slice indexed here
|
2023-08-31 16:42:27 +00:00
|
|
|
--> $DIR/missing_asserts_for_indexing_unfixable.rs:10:13
|
2023-04-21 21:58:55 +00:00
|
|
|
|
|
|
|
|
LL | let _ = v[0];
|
|
|
|
| ^^^^
|
|
|
|
note: slice indexed here
|
|
|
|
--> $DIR/missing_asserts_for_indexing_unfixable.rs:12:13
|
|
|
|
|
|
|
|
|
LL | let _ = v[1..4];
|
|
|
|
| ^^^^^^^
|
|
|
|
= note: asserting the length before indexing will elide bounds checks
|
|
|
|
|
|
|
|
error: indexing into a slice multiple times without an `assert`
|
2023-08-31 16:42:27 +00:00
|
|
|
--> $DIR/missing_asserts_for_indexing_unfixable.rs:16:13
|
2023-04-21 21:58:55 +00:00
|
|
|
|
|
|
|
|
LL | let a = v[0];
|
|
|
|
| _____________^
|
2023-08-31 16:42:27 +00:00
|
|
|
LL | |
|
2023-04-21 21:58:55 +00:00
|
|
|
LL | | let b = v[1];
|
|
|
|
LL | | let c = v[2];
|
|
|
|
| |________________^
|
|
|
|
|
|
|
|
|
= help: consider asserting the length before indexing: `assert!(v.len() > 2);`
|
|
|
|
note: slice indexed here
|
2023-08-31 16:42:27 +00:00
|
|
|
--> $DIR/missing_asserts_for_indexing_unfixable.rs:16:13
|
2023-04-21 21:58:55 +00:00
|
|
|
|
|
|
|
|
LL | let a = v[0];
|
|
|
|
| ^^^^
|
|
|
|
note: slice indexed here
|
|
|
|
--> $DIR/missing_asserts_for_indexing_unfixable.rs:18:13
|
|
|
|
|
|
|
|
|
LL | let b = v[1];
|
|
|
|
| ^^^^
|
|
|
|
note: slice indexed here
|
|
|
|
--> $DIR/missing_asserts_for_indexing_unfixable.rs:19:13
|
|
|
|
|
|
|
|
|
LL | let c = v[2];
|
|
|
|
| ^^^^
|
|
|
|
= note: asserting the length before indexing will elide bounds checks
|
|
|
|
|
|
|
|
error: indexing into a slice multiple times without an `assert`
|
|
|
|
--> $DIR/missing_asserts_for_indexing_unfixable.rs:24:13
|
|
|
|
|
|
|
|
|
LL | let _ = v1[0] + v1[12];
|
|
|
|
| ^^^^^^^^^^^^^^
|
|
|
|
|
|
|
|
|
= help: consider asserting the length before indexing: `assert!(v1.len() > 12);`
|
|
|
|
note: slice indexed here
|
|
|
|
--> $DIR/missing_asserts_for_indexing_unfixable.rs:24:13
|
|
|
|
|
|
|
|
|
LL | let _ = v1[0] + v1[12];
|
|
|
|
| ^^^^^
|
|
|
|
note: slice indexed here
|
|
|
|
--> $DIR/missing_asserts_for_indexing_unfixable.rs:24:21
|
|
|
|
|
|
|
|
|
LL | let _ = v1[0] + v1[12];
|
|
|
|
| ^^^^^^
|
|
|
|
= note: asserting the length before indexing will elide bounds checks
|
|
|
|
|
|
|
|
error: indexing into a slice multiple times without an `assert`
|
|
|
|
--> $DIR/missing_asserts_for_indexing_unfixable.rs:25:13
|
|
|
|
|
|
|
|
|
LL | let _ = v2[5] + v2[15];
|
|
|
|
| ^^^^^^^^^^^^^^
|
|
|
|
|
|
|
|
|
= help: consider asserting the length before indexing: `assert!(v2.len() > 15);`
|
|
|
|
note: slice indexed here
|
|
|
|
--> $DIR/missing_asserts_for_indexing_unfixable.rs:25:13
|
|
|
|
|
|
|
|
|
LL | let _ = v2[5] + v2[15];
|
|
|
|
| ^^^^^
|
|
|
|
note: slice indexed here
|
|
|
|
--> $DIR/missing_asserts_for_indexing_unfixable.rs:25:21
|
|
|
|
|
|
|
|
|
LL | let _ = v2[5] + v2[15];
|
|
|
|
| ^^^^^^
|
|
|
|
= note: asserting the length before indexing will elide bounds checks
|
|
|
|
|
|
|
|
error: indexing into a slice multiple times without an `assert`
|
|
|
|
--> $DIR/missing_asserts_for_indexing_unfixable.rs:31:13
|
|
|
|
|
|
|
|
|
LL | let _ = v2[5] + v2[15];
|
|
|
|
| ^^^^^^^^^^^^^^
|
|
|
|
|
|
|
|
|
= help: consider asserting the length before indexing: `assert!(v2.len() > 15);`
|
|
|
|
note: slice indexed here
|
|
|
|
--> $DIR/missing_asserts_for_indexing_unfixable.rs:31:13
|
|
|
|
|
|
|
|
|
LL | let _ = v2[5] + v2[15];
|
|
|
|
| ^^^^^
|
|
|
|
note: slice indexed here
|
|
|
|
--> $DIR/missing_asserts_for_indexing_unfixable.rs:31:21
|
|
|
|
|
|
|
|
|
LL | let _ = v2[5] + v2[15];
|
|
|
|
| ^^^^^^
|
|
|
|
= note: asserting the length before indexing will elide bounds checks
|
|
|
|
|
|
|
|
error: indexing into a slice multiple times without an `assert`
|
|
|
|
--> $DIR/missing_asserts_for_indexing_unfixable.rs:40:13
|
|
|
|
|
|
|
|
|
LL | let _ = f.v[0] + f.v[1];
|
|
|
|
| ^^^^^^^^^^^^^^^
|
|
|
|
|
|
|
|
|
= help: consider asserting the length before indexing: `assert!(f.v.len() > 1);`
|
|
|
|
note: slice indexed here
|
|
|
|
--> $DIR/missing_asserts_for_indexing_unfixable.rs:40:13
|
|
|
|
|
|
|
|
|
LL | let _ = f.v[0] + f.v[1];
|
|
|
|
| ^^^^^^
|
|
|
|
note: slice indexed here
|
|
|
|
--> $DIR/missing_asserts_for_indexing_unfixable.rs:40:22
|
|
|
|
|
|
|
|
|
LL | let _ = f.v[0] + f.v[1];
|
|
|
|
| ^^^^^^
|
|
|
|
= note: asserting the length before indexing will elide bounds checks
|
|
|
|
|
2023-11-23 07:48:36 +00:00
|
|
|
error: indexing into a slice multiple times without an `assert`
|
|
|
|
--> $DIR/missing_asserts_for_indexing_unfixable.rs:54:13
|
|
|
|
|
|
|
|
|
LL | let _ = x[0] + x[1];
|
|
|
|
| ^^^^^^^^^^^
|
|
|
|
|
|
|
|
|
= help: consider asserting the length before indexing: `assert!(x.len() > 1);`
|
|
|
|
note: slice indexed here
|
|
|
|
--> $DIR/missing_asserts_for_indexing_unfixable.rs:54:13
|
|
|
|
|
|
|
|
|
LL | let _ = x[0] + x[1];
|
|
|
|
| ^^^^
|
|
|
|
note: slice indexed here
|
|
|
|
--> $DIR/missing_asserts_for_indexing_unfixable.rs:54:20
|
|
|
|
|
|
|
|
|
LL | let _ = x[0] + x[1];
|
|
|
|
| ^^^^
|
|
|
|
= note: asserting the length before indexing will elide bounds checks
|
|
|
|
|
|
|
|
error: aborting due to 8 previous errors
|
2023-04-21 21:58:55 +00:00
|
|
|
|