284 lines
6.4 KiB
Plaintext
284 lines
6.4 KiB
Plaintext
error: indexing may panic.
|
|
--> $DIR/indexing_slicing.rs:23:5
|
|
|
|
|
23 | x[index];
|
|
| ^^^^^^^^
|
|
|
|
|
= note: `-D clippy::indexing-slicing` implied by `-D warnings`
|
|
= help: Consider using `.get(n)` or `.get_mut(n)` instead
|
|
|
|
error: slicing may panic.
|
|
--> $DIR/indexing_slicing.rs:24:6
|
|
|
|
|
24 | &x[index..];
|
|
| ^^^^^^^^^^
|
|
|
|
|
= help: Consider using `.get(n..)` or .get_mut(n..)` instead
|
|
|
|
error: slicing may panic.
|
|
--> $DIR/indexing_slicing.rs:25:6
|
|
|
|
|
25 | &x[..index];
|
|
| ^^^^^^^^^^
|
|
|
|
|
= help: Consider using `.get(..n)`or `.get_mut(..n)` instead
|
|
|
|
error: slicing may panic.
|
|
--> $DIR/indexing_slicing.rs:26:6
|
|
|
|
|
26 | &x[index_from..index_to];
|
|
| ^^^^^^^^^^^^^^^^^^^^^^^
|
|
|
|
|
= help: Consider using `.get(n..m)` or `.get_mut(n..m)` instead
|
|
|
|
error: slicing may panic.
|
|
--> $DIR/indexing_slicing.rs:27:6
|
|
|
|
|
27 | &x[index_from..][..index_to]; // Two lint reports, one for [index_from..] and another for [..index_to].
|
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
|
|
|
|
= help: Consider using `.get(..n)`or `.get_mut(..n)` instead
|
|
|
|
error: slicing may panic.
|
|
--> $DIR/indexing_slicing.rs:27:6
|
|
|
|
|
27 | &x[index_from..][..index_to]; // Two lint reports, one for [index_from..] and another for [..index_to].
|
|
| ^^^^^^^^^^^^^^^
|
|
|
|
|
= help: Consider using `.get(n..)` or .get_mut(n..)` instead
|
|
|
|
error: range is out of bounds
|
|
--> $DIR/indexing_slicing.rs:30:11
|
|
|
|
|
30 | &x[..=4];
|
|
| ^
|
|
|
|
|
= note: `-D clippy::out-of-bounds-indexing` implied by `-D warnings`
|
|
|
|
error: range is out of bounds
|
|
--> $DIR/indexing_slicing.rs:31:11
|
|
|
|
|
31 | &x[1..5];
|
|
| ^
|
|
|
|
error: slicing may panic.
|
|
--> $DIR/indexing_slicing.rs:32:6
|
|
|
|
|
32 | &x[5..][..10]; // Two lint reports, one for [5..] and another for [..10].
|
|
| ^^^^^^^^^^^^
|
|
|
|
|
= help: Consider using `.get(..n)`or `.get_mut(..n)` instead
|
|
|
|
error: range is out of bounds
|
|
--> $DIR/indexing_slicing.rs:32:8
|
|
|
|
|
32 | &x[5..][..10]; // Two lint reports, one for [5..] and another for [..10].
|
|
| ^
|
|
|
|
error: range is out of bounds
|
|
--> $DIR/indexing_slicing.rs:33:8
|
|
|
|
|
33 | &x[5..];
|
|
| ^
|
|
|
|
error: range is out of bounds
|
|
--> $DIR/indexing_slicing.rs:34:10
|
|
|
|
|
34 | &x[..5];
|
|
| ^
|
|
|
|
error: range is out of bounds
|
|
--> $DIR/indexing_slicing.rs:35:8
|
|
|
|
|
35 | &x[5..].iter().map(|x| 2 * x).collect::<Vec<i32>>();
|
|
| ^
|
|
|
|
error: range is out of bounds
|
|
--> $DIR/indexing_slicing.rs:36:12
|
|
|
|
|
36 | &x[0..=4];
|
|
| ^
|
|
|
|
error: slicing may panic.
|
|
--> $DIR/indexing_slicing.rs:37:6
|
|
|
|
|
37 | &x[0..][..3];
|
|
| ^^^^^^^^^^^
|
|
|
|
|
= help: Consider using `.get(..n)`or `.get_mut(..n)` instead
|
|
|
|
error: slicing may panic.
|
|
--> $DIR/indexing_slicing.rs:38:6
|
|
|
|
|
38 | &x[1..][..5];
|
|
| ^^^^^^^^^^^
|
|
|
|
|
= help: Consider using `.get(..n)`or `.get_mut(..n)` instead
|
|
|
|
error: indexing may panic.
|
|
--> $DIR/indexing_slicing.rs:51:5
|
|
|
|
|
51 | y[0];
|
|
| ^^^^
|
|
|
|
|
= help: Consider using `.get(n)` or `.get_mut(n)` instead
|
|
|
|
error: slicing may panic.
|
|
--> $DIR/indexing_slicing.rs:52:6
|
|
|
|
|
52 | &y[1..2];
|
|
| ^^^^^^^
|
|
|
|
|
= help: Consider using `.get(n..m)` or `.get_mut(n..m)` instead
|
|
|
|
error: slicing may panic.
|
|
--> $DIR/indexing_slicing.rs:53:6
|
|
|
|
|
53 | &y[0..=4];
|
|
| ^^^^^^^^
|
|
|
|
|
= help: Consider using `.get(n..m)` or `.get_mut(n..m)` instead
|
|
|
|
error: slicing may panic.
|
|
--> $DIR/indexing_slicing.rs:54:6
|
|
|
|
|
54 | &y[..=4];
|
|
| ^^^^^^^
|
|
|
|
|
= help: Consider using `.get(..n)`or `.get_mut(..n)` instead
|
|
|
|
error: range is out of bounds
|
|
--> $DIR/indexing_slicing.rs:60:12
|
|
|
|
|
60 | &empty[1..5];
|
|
| ^
|
|
|
|
error: range is out of bounds
|
|
--> $DIR/indexing_slicing.rs:61:16
|
|
|
|
|
61 | &empty[0..=4];
|
|
| ^
|
|
|
|
error: range is out of bounds
|
|
--> $DIR/indexing_slicing.rs:62:15
|
|
|
|
|
62 | &empty[..=4];
|
|
| ^
|
|
|
|
error: range is out of bounds
|
|
--> $DIR/indexing_slicing.rs:63:12
|
|
|
|
|
63 | &empty[1..];
|
|
| ^
|
|
|
|
error: range is out of bounds
|
|
--> $DIR/indexing_slicing.rs:64:14
|
|
|
|
|
64 | &empty[..4];
|
|
| ^
|
|
|
|
error: range is out of bounds
|
|
--> $DIR/indexing_slicing.rs:65:16
|
|
|
|
|
65 | &empty[0..=0];
|
|
| ^
|
|
|
|
error: range is out of bounds
|
|
--> $DIR/indexing_slicing.rs:66:15
|
|
|
|
|
66 | &empty[..=0];
|
|
| ^
|
|
|
|
error: indexing may panic.
|
|
--> $DIR/indexing_slicing.rs:74:5
|
|
|
|
|
74 | v[0];
|
|
| ^^^^
|
|
|
|
|
= help: Consider using `.get(n)` or `.get_mut(n)` instead
|
|
|
|
error: indexing may panic.
|
|
--> $DIR/indexing_slicing.rs:75:5
|
|
|
|
|
75 | v[10];
|
|
| ^^^^^
|
|
|
|
|
= help: Consider using `.get(n)` or `.get_mut(n)` instead
|
|
|
|
error: indexing may panic.
|
|
--> $DIR/indexing_slicing.rs:76:5
|
|
|
|
|
76 | v[1 << 3];
|
|
| ^^^^^^^^^
|
|
|
|
|
= help: Consider using `.get(n)` or `.get_mut(n)` instead
|
|
|
|
error: slicing may panic.
|
|
--> $DIR/indexing_slicing.rs:77:6
|
|
|
|
|
77 | &v[10..100];
|
|
| ^^^^^^^^^^
|
|
|
|
|
= help: Consider using `.get(n..m)` or `.get_mut(n..m)` instead
|
|
|
|
error: slicing may panic.
|
|
--> $DIR/indexing_slicing.rs:78:6
|
|
|
|
|
78 | &x[10..][..100]; // Two lint reports, one for [10..] and another for [..100].
|
|
| ^^^^^^^^^^^^^^
|
|
|
|
|
= help: Consider using `.get(..n)`or `.get_mut(..n)` instead
|
|
|
|
error: range is out of bounds
|
|
--> $DIR/indexing_slicing.rs:78:8
|
|
|
|
|
78 | &x[10..][..100]; // Two lint reports, one for [10..] and another for [..100].
|
|
| ^^
|
|
|
|
error: slicing may panic.
|
|
--> $DIR/indexing_slicing.rs:79:6
|
|
|
|
|
79 | &v[10..];
|
|
| ^^^^^^^
|
|
|
|
|
= help: Consider using `.get(n..)` or .get_mut(n..)` instead
|
|
|
|
error: slicing may panic.
|
|
--> $DIR/indexing_slicing.rs:80:6
|
|
|
|
|
80 | &v[..100];
|
|
| ^^^^^^^^
|
|
|
|
|
= help: Consider using `.get(..n)`or `.get_mut(..n)` instead
|
|
|
|
error: indexing may panic.
|
|
--> $DIR/indexing_slicing.rs:92:5
|
|
|
|
|
92 | v[N];
|
|
| ^^^^
|
|
|
|
|
= help: Consider using `.get(n)` or `.get_mut(n)` instead
|
|
|
|
error: indexing may panic.
|
|
--> $DIR/indexing_slicing.rs:93:5
|
|
|
|
|
93 | v[M];
|
|
| ^^^^
|
|
|
|
|
= help: Consider using `.get(n)` or `.get_mut(n)` instead
|
|
|
|
error: range is out of bounds
|
|
--> $DIR/indexing_slicing.rs:97:13
|
|
|
|
|
97 | &x[num..10]; // should trigger out of bounds error
|
|
| ^^
|
|
|
|
error: range is out of bounds
|
|
--> $DIR/indexing_slicing.rs:98:8
|
|
|
|
|
98 | &x[10..num]; // should trigger out of bounds error
|
|
| ^^
|
|
|
|
error: aborting due to 39 previous errors
|
|
|