@@ -9,42 +9,36 @@ note: the lint level is defined here
9
9
|
10
10
LL | #![deny(clippy::index_refutable_slice)]
11
11
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
12
- help: try using a slice pattern here
12
+ help: replace the binding and indexed access with a slice pattern
13
13
|
14
- LL | if let Some([slice_0, ..]) = slice {
15
- | ~~~~~~~~~~~~~
16
- help: and replace the index expressions here
14
+ LL ~ if let Some([slice_0, ..]) = slice {
15
+ LL |
16
+ LL ~ println!("{}", slice_0);
17
17
|
18
- LL | println!("{}", slice_0);
19
- | ~~~~~~~
20
18
21
19
error: this binding can be a slice pattern to avoid indexing
22
20
--> tests/ui/index_refutable_slice/if_let_slice_binding.rs:23:17
23
21
|
24
22
LL | if let Some(slice) = slice {
25
23
| ^^^^^
26
24
|
27
- help: try using a slice pattern here
25
+ help: replace the binding and indexed access with a slice pattern
28
26
|
29
- LL | if let Some([slice_0, ..]) = slice {
30
- | ~~~~~~~~~~~~~
31
- help: and replace the index expressions here
27
+ LL ~ if let Some([slice_0, ..]) = slice {
28
+ LL |
29
+ LL ~ println!("{}", slice_0);
32
30
|
33
- LL | println!("{}", slice_0);
34
- | ~~~~~~~
35
31
36
32
error: this binding can be a slice pattern to avoid indexing
37
33
--> tests/ui/index_refutable_slice/if_let_slice_binding.rs:30:17
38
34
|
39
35
LL | if let Some(slice) = slice {
40
36
| ^^^^^
41
37
|
42
- help: try using a slice pattern here
43
- |
44
- LL | if let Some([slice_0, _, slice_2, ..]) = slice {
45
- | ~~~~~~~~~~~~~~~~~~~~~~~~~
46
- help: and replace the index expressions here
38
+ help: replace the binding and indexed access with a slice pattern
47
39
|
40
+ LL ~ if let Some([slice_0, _, slice_2, ..]) = slice {
41
+ LL |
48
42
LL ~ println!("{}", slice_2);
49
43
LL ~ println!("{}", slice_0);
50
44
|
@@ -55,104 +49,94 @@ error: this binding can be a slice pattern to avoid indexing
55
49
LL | if let SomeEnum::One(slice) | SomeEnum::Three(slice) = slice_wrapped {
56
50
| ^^^^^
57
51
|
58
- help: try using a slice pattern here
52
+ help: replace the binding and indexed access with a slice pattern
59
53
|
60
- LL | if let SomeEnum::One([slice_0, ..]) | SomeEnum::Three([slice_0, ..]) = slice_wrapped {
61
- | ~~~~~~~~~~~~~ ~~~~~~~~~~~~~
62
- help: and replace the index expressions here
54
+ LL ~ if let SomeEnum::One([slice_0, ..]) | SomeEnum::Three([slice_0, ..]) = slice_wrapped {
55
+ LL |
56
+ LL ~ println!("{}", slice_0);
63
57
|
64
- LL | println!("{}", slice_0);
65
- | ~~~~~~~
66
58
67
59
error: this binding can be a slice pattern to avoid indexing
68
60
--> tests/ui/index_refutable_slice/if_let_slice_binding.rs:46:29
69
61
|
70
62
LL | if let (SomeEnum::Three(a), Some(b)) = (a_wrapped, b_wrapped) {
71
63
| ^
72
64
|
73
- help: try using a slice pattern here
65
+ help: replace the binding and indexed access with a slice pattern
74
66
|
75
- LL | if let (SomeEnum::Three([_, _, a_2, ..]), Some(b)) = (a_wrapped, b_wrapped) {
76
- | ~~~~~~~~~~~~~~~
77
- help: and replace the index expressions here
67
+ LL ~ if let (SomeEnum::Three([_, _, a_2, ..]), Some(b)) = (a_wrapped, b_wrapped) {
68
+ LL |
69
+ LL |
70
+ LL ~ println!("{} -> {}", a_2, b[1]);
78
71
|
79
- LL | println!("{} -> {}", a_2, b[1]);
80
- | ~~~
81
72
82
73
error: this binding can be a slice pattern to avoid indexing
83
74
--> tests/ui/index_refutable_slice/if_let_slice_binding.rs:46:38
84
75
|
85
76
LL | if let (SomeEnum::Three(a), Some(b)) = (a_wrapped, b_wrapped) {
86
77
| ^
87
78
|
88
- help: try using a slice pattern here
79
+ help: replace the binding and indexed access with a slice pattern
89
80
|
90
- LL | if let (SomeEnum::Three(a), Some([_, b_1, ..])) = (a_wrapped, b_wrapped) {
91
- | ~~~~~~~~~~~~
92
- help: and replace the index expressions here
81
+ LL ~ if let (SomeEnum::Three(a), Some([_, b_1, ..])) = (a_wrapped, b_wrapped) {
82
+ LL |
83
+ LL |
84
+ LL ~ println!("{} -> {}", a[2], b_1);
93
85
|
94
- LL | println!("{} -> {}", a[2], b_1);
95
- | ~~~
96
86
97
87
error: this binding can be a slice pattern to avoid indexing
98
88
--> tests/ui/index_refutable_slice/if_let_slice_binding.rs:55:21
99
89
|
100
90
LL | if let Some(ref slice) = slice {
101
91
| ^^^^^
102
92
|
103
- help: try using a slice pattern here
93
+ help: replace the binding and indexed access with a slice pattern
104
94
|
105
- LL | if let Some([_, ref slice_1, ..]) = slice {
106
- | ~~~~~~~~~~~~~~~~~~~~
107
- help: and replace the index expressions here
95
+ LL ~ if let Some([_, ref slice_1, ..]) = slice {
96
+ LL |
97
+ LL ~ println!("{:?}", slice_1);
108
98
|
109
- LL | println!("{:?}", slice_1);
110
- | ~~~~~~~
111
99
112
100
error: this binding can be a slice pattern to avoid indexing
113
101
--> tests/ui/index_refutable_slice/if_let_slice_binding.rs:64:17
114
102
|
115
103
LL | if let Some(slice) = &slice {
116
104
| ^^^^^
117
105
|
118
- help: try using a slice pattern here
106
+ help: replace the binding and indexed access with a slice pattern
119
107
|
120
- LL | if let Some([slice_0, ..]) = &slice {
121
- | ~~~~~~~~~~~~~
122
- help: and replace the index expressions here
108
+ LL ~ if let Some([slice_0, ..]) = &slice {
109
+ LL |
110
+ LL ~ println!("{:?}", slice_0);
123
111
|
124
- LL | println!("{:?}", slice_0);
125
- | ~~~~~~~
126
112
127
113
error: this binding can be a slice pattern to avoid indexing
128
114
--> tests/ui/index_refutable_slice/if_let_slice_binding.rs:134:17
129
115
|
130
116
LL | if let Some(slice) = wrap.inner {
131
117
| ^^^^^
132
118
|
133
- help: try using a slice pattern here
119
+ help: replace the binding and indexed access with a slice pattern
134
120
|
135
- LL | if let Some([slice_0, ..]) = wrap.inner {
136
- | ~~~~~~~~~~~~~
137
- help: and replace the index expressions here
121
+ LL ~ if let Some([slice_0, ..]) = wrap.inner {
122
+ LL |
123
+ LL | if wrap.is_awesome {
124
+ LL ~ println!("This is awesome! {}", slice_0);
138
125
|
139
- LL | println!("This is awesome! {}", slice_0);
140
- | ~~~~~~~
141
126
142
127
error: this binding can be a slice pattern to avoid indexing
143
128
--> tests/ui/index_refutable_slice/if_let_slice_binding.rs:142:17
144
129
|
145
130
LL | if let Some(slice) = wrap.inner {
146
131
| ^^^^^
147
132
|
148
- help: try using a slice pattern here
133
+ help: replace the binding and indexed access with a slice pattern
149
134
|
150
- LL | if let Some([slice_0, ..]) = wrap.inner {
151
- | ~~~~~~~~~~~~~
152
- help: and replace the index expressions here
135
+ LL ~ if let Some([slice_0, ..]) = wrap.inner {
136
+ LL |
137
+ LL | if wrap.is_super_awesome() {
138
+ LL ~ println!("This is super awesome! {}", slice_0);
153
139
|
154
- LL | println!("This is super awesome! {}", slice_0);
155
- | ~~~~~~~
156
140
157
141
error: aborting due to 10 previous errors
158
142
0 commit comments