blob: f70722b92a5b8186738a754850e171e3e8e93c42 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
|
error: slicing may panic
--> $DIR/indexing_slicing_slice.rs:12:6
|
LL | &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_slice.rs:13:6
|
LL | &x[..index];
| ^^^^^^^^^^
|
= help: consider using `.get(..n)`or `.get_mut(..n)` instead
error: slicing may panic
--> $DIR/indexing_slicing_slice.rs:14:6
|
LL | &x[index_from..index_to];
| ^^^^^^^^^^^^^^^^^^^^^^^
|
= help: consider using `.get(n..m)` or `.get_mut(n..m)` instead
error: slicing may panic
--> $DIR/indexing_slicing_slice.rs:15:6
|
LL | &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_slice.rs:15:6
|
LL | &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_slice.rs:16:6
|
LL | &x[5..][..10]; // Two lint reports, one for out of bounds [5..] and another for slicing [..10].
| ^^^^^^^^^^^^
|
= help: consider using `.get(..n)`or `.get_mut(..n)` instead
error: range is out of bounds
--> $DIR/indexing_slicing_slice.rs:16:8
|
LL | &x[5..][..10]; // Two lint reports, one for out of bounds [5..] and another for slicing [..10].
| ^
|
= note: `-D clippy::out-of-bounds-indexing` implied by `-D warnings`
error: slicing may panic
--> $DIR/indexing_slicing_slice.rs:17:6
|
LL | &x[0..][..3];
| ^^^^^^^^^^^
|
= help: consider using `.get(..n)`or `.get_mut(..n)` instead
error: slicing may panic
--> $DIR/indexing_slicing_slice.rs:18:6
|
LL | &x[1..][..5];
| ^^^^^^^^^^^
|
= help: consider using `.get(..n)`or `.get_mut(..n)` instead
error: range is out of bounds
--> $DIR/indexing_slicing_slice.rs:25:12
|
LL | &y[0..=4];
| ^
error: range is out of bounds
--> $DIR/indexing_slicing_slice.rs:26:11
|
LL | &y[..=4];
| ^
error: slicing may panic
--> $DIR/indexing_slicing_slice.rs:31:6
|
LL | &v[10..100];
| ^^^^^^^^^^
|
= help: consider using `.get(n..m)` or `.get_mut(n..m)` instead
error: slicing may panic
--> $DIR/indexing_slicing_slice.rs:32:6
|
LL | &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_slice.rs:32:8
|
LL | &x[10..][..100]; // Two lint reports, one for [10..] and another for [..100].
| ^^
error: slicing may panic
--> $DIR/indexing_slicing_slice.rs:33:6
|
LL | &v[10..];
| ^^^^^^^
|
= help: consider using `.get(n..)` or .get_mut(n..)` instead
error: slicing may panic
--> $DIR/indexing_slicing_slice.rs:34:6
|
LL | &v[..100];
| ^^^^^^^^
|
= help: consider using `.get(..n)`or `.get_mut(..n)` instead
error: aborting due to 16 previous errors
|