summaryrefslogtreecommitdiffstats
path: root/src/tools/clippy/tests/ui/index_refutable_slice/if_let_slice_binding.stderr
blob: 0a13ac1354e57b1cc209daccfa5368a53dbc57e7 (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
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
error: this binding can be a slice pattern to avoid indexing
  --> $DIR/if_let_slice_binding.rs:14:17
   |
LL |     if let Some(slice) = slice {
   |                 ^^^^^
   |
note: the lint level is defined here
  --> $DIR/if_let_slice_binding.rs:1:9
   |
LL | #![deny(clippy::index_refutable_slice)]
   |         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
help: try using a slice pattern here
   |
LL |     if let Some([slice_0, ..]) = slice {
   |                 ~~~~~~~~~~~~~
help: and replace the index expressions here
   |
LL |         println!("{}", slice_0);
   |                        ~~~~~~~

error: this binding can be a slice pattern to avoid indexing
  --> $DIR/if_let_slice_binding.rs:20:17
   |
LL |     if let Some(slice) = slice {
   |                 ^^^^^
   |
help: try using a slice pattern here
   |
LL |     if let Some([slice_0, ..]) = slice {
   |                 ~~~~~~~~~~~~~
help: and replace the index expressions here
   |
LL |         println!("{}", slice_0);
   |                        ~~~~~~~

error: this binding can be a slice pattern to avoid indexing
  --> $DIR/if_let_slice_binding.rs:26:17
   |
LL |     if let Some(slice) = slice {
   |                 ^^^^^
   |
help: try using a slice pattern here
   |
LL |     if let Some([slice_0, _, slice_2, ..]) = slice {
   |                 ~~~~~~~~~~~~~~~~~~~~~~~~~
help: and replace the index expressions here
   |
LL ~         println!("{}", slice_2);
LL ~         println!("{}", slice_0);
   |

error: this binding can be a slice pattern to avoid indexing
  --> $DIR/if_let_slice_binding.rs:33:26
   |
LL |     if let SomeEnum::One(slice) | SomeEnum::Three(slice) = slice_wrapped {
   |                          ^^^^^
   |
help: try using a slice pattern here
   |
LL |     if let SomeEnum::One([slice_0, ..]) | SomeEnum::Three([slice_0, ..]) = slice_wrapped {
   |                          ~~~~~~~~~~~~~                    ~~~~~~~~~~~~~
help: and replace the index expressions here
   |
LL |         println!("{}", slice_0);
   |                        ~~~~~~~

error: this binding can be a slice pattern to avoid indexing
  --> $DIR/if_let_slice_binding.rs:40:29
   |
LL |     if let (SomeEnum::Three(a), Some(b)) = (a_wrapped, b_wrapped) {
   |                             ^
   |
help: try using a slice pattern here
   |
LL |     if let (SomeEnum::Three([_, _, a_2, ..]), Some(b)) = (a_wrapped, b_wrapped) {
   |                             ~~~~~~~~~~~~~~~
help: and replace the index expressions here
   |
LL |         println!("{} -> {}", a_2, b[1]);
   |                              ~~~

error: this binding can be a slice pattern to avoid indexing
  --> $DIR/if_let_slice_binding.rs:40:38
   |
LL |     if let (SomeEnum::Three(a), Some(b)) = (a_wrapped, b_wrapped) {
   |                                      ^
   |
help: try using a slice pattern here
   |
LL |     if let (SomeEnum::Three(a), Some([_, b_1, ..])) = (a_wrapped, b_wrapped) {
   |                                      ~~~~~~~~~~~~
help: and replace the index expressions here
   |
LL |         println!("{} -> {}", a[2], b_1);
   |                                    ~~~

error: this binding can be a slice pattern to avoid indexing
  --> $DIR/if_let_slice_binding.rs:47:21
   |
LL |     if let Some(ref slice) = slice {
   |                     ^^^^^
   |
help: try using a slice pattern here
   |
LL |     if let Some([_, ref slice_1, ..]) = slice {
   |                 ~~~~~~~~~~~~~~~~~~~~
help: and replace the index expressions here
   |
LL |         println!("{:?}", slice_1);
   |                          ~~~~~~~

error: this binding can be a slice pattern to avoid indexing
  --> $DIR/if_let_slice_binding.rs:55:17
   |
LL |     if let Some(slice) = &slice {
   |                 ^^^^^
   |
help: try using a slice pattern here
   |
LL |     if let Some([slice_0, ..]) = &slice {
   |                 ~~~~~~~~~~~~~
help: and replace the index expressions here
   |
LL |         println!("{:?}", slice_0);
   |                          ~~~~~~~

error: this binding can be a slice pattern to avoid indexing
  --> $DIR/if_let_slice_binding.rs:124:17
   |
LL |     if let Some(slice) = wrap.inner {
   |                 ^^^^^
   |
help: try using a slice pattern here
   |
LL |     if let Some([slice_0, ..]) = wrap.inner {
   |                 ~~~~~~~~~~~~~
help: and replace the index expressions here
   |
LL |             println!("This is awesome! {}", slice_0);
   |                                             ~~~~~~~

error: this binding can be a slice pattern to avoid indexing
  --> $DIR/if_let_slice_binding.rs:131:17
   |
LL |     if let Some(slice) = wrap.inner {
   |                 ^^^^^
   |
help: try using a slice pattern here
   |
LL |     if let Some([slice_0, ..]) = wrap.inner {
   |                 ~~~~~~~~~~~~~
help: and replace the index expressions here
   |
LL |             println!("This is super awesome! {}", slice_0);
   |                                                   ~~~~~~~

error: aborting due to 10 previous errors