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