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