]> git.proxmox.com Git - rustc.git/blame - src/tools/clippy/tests/ui/manual_find_map.stderr
New upstream version 1.75.0+dfsg1
[rustc.git] / src / tools / clippy / tests / ui / manual_find_map.stderr
CommitLineData
f20569fa 1error: `find(..).map(..)` can be simplified as `find_map(..)`
ed00b5ec 2 --> $DIR/manual_find_map.rs:9:19
f20569fa
XL
3 |
4LL | let _ = (0..).find(|n| to_opt(*n).is_some()).map(|a| to_opt(a).unwrap());
5 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `find_map(|a| to_opt(a))`
6 |
add651ee 7note: the suggestion might change the behavior of the program when merging `filter` and `map`, because this expression potentially contains side effects and will only execute once
ed00b5ec 8 --> $DIR/manual_find_map.rs:9:28
add651ee
FG
9 |
10LL | let _ = (0..).find(|n| to_opt(*n).is_some()).map(|a| to_opt(a).unwrap());
11 | ^^^^^^^^^^
f20569fa 12 = note: `-D clippy::manual-find-map` implied by `-D warnings`
781aab86 13 = help: to override `-D warnings` add `#[allow(clippy::manual_find_map)]`
f20569fa
XL
14
15error: `find(..).map(..)` can be simplified as `find_map(..)`
ed00b5ec 16 --> $DIR/manual_find_map.rs:12:19
f20569fa
XL
17 |
18LL | let _ = (0..).find(|&n| to_opt(n).is_some()).map(|a| to_opt(a).expect("hi"));
19 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `find_map(|a| to_opt(a))`
add651ee
FG
20 |
21note: the suggestion might change the behavior of the program when merging `filter` and `map`, because this expression potentially contains side effects and will only execute once
ed00b5ec 22 --> $DIR/manual_find_map.rs:12:29
add651ee
FG
23 |
24LL | let _ = (0..).find(|&n| to_opt(n).is_some()).map(|a| to_opt(a).expect("hi"));
25 | ^^^^^^^^^
f20569fa
XL
26
27error: `find(..).map(..)` can be simplified as `find_map(..)`
ed00b5ec 28 --> $DIR/manual_find_map.rs:15:19
f20569fa
XL
29 |
30LL | let _ = (0..).find(|&n| to_res(n).is_ok()).map(|a| to_res(a).unwrap_or(1));
31 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `find_map(|a| to_res(a).ok())`
add651ee
FG
32 |
33note: the suggestion might change the behavior of the program when merging `filter` and `map`, because this expression potentially contains side effects and will only execute once
ed00b5ec 34 --> $DIR/manual_find_map.rs:15:29
add651ee
FG
35 |
36LL | let _ = (0..).find(|&n| to_res(n).is_ok()).map(|a| to_res(a).unwrap_or(1));
37 | ^^^^^^^^^
f20569fa 38
923072b8 39error: `find(..).map(..)` can be simplified as `find_map(..)`
ed00b5ec 40 --> $DIR/manual_find_map.rs:18:10
064997fb
FG
41 |
42LL | .find(|&x| to_ref(to_opt(x)).is_some())
43 | __________^
44LL | | .map(|y| to_ref(to_opt(y)).unwrap());
45 | |____________________________________________^ help: try: `find_map(|y| *to_ref(to_opt(y)))`
add651ee
FG
46 |
47note: the suggestion might change the behavior of the program when merging `filter` and `map`, because this expression potentially contains side effects and will only execute once
ed00b5ec 48 --> $DIR/manual_find_map.rs:18:20
add651ee
FG
49 |
50LL | .find(|&x| to_ref(to_opt(x)).is_some())
51 | ^^^^^^^^^^^^^^^^^
064997fb
FG
52
53error: `find(..).map(..)` can be simplified as `find_map(..)`
ed00b5ec 54 --> $DIR/manual_find_map.rs:21:10
064997fb
FG
55 |
56LL | .find(|x| to_ref(to_opt(*x)).is_some())
57 | __________^
58LL | | .map(|y| to_ref(to_opt(y)).unwrap());
59 | |____________________________________________^ help: try: `find_map(|y| *to_ref(to_opt(y)))`
add651ee
FG
60 |
61note: the suggestion might change the behavior of the program when merging `filter` and `map`, because this expression potentially contains side effects and will only execute once
ed00b5ec 62 --> $DIR/manual_find_map.rs:21:19
add651ee
FG
63 |
64LL | .find(|x| to_ref(to_opt(*x)).is_some())
65 | ^^^^^^^^^^^^^^^^^^
064997fb
FG
66
67error: `find(..).map(..)` can be simplified as `find_map(..)`
ed00b5ec 68 --> $DIR/manual_find_map.rs:25:10
064997fb
FG
69 |
70LL | .find(|&x| to_ref(to_res(x)).is_ok())
71 | __________^
72LL | | .map(|y| to_ref(to_res(y)).unwrap());
73 | |____________________________________________^ help: try: `find_map(|y| to_ref(to_res(y)).ok())`
add651ee
FG
74 |
75note: the suggestion might change the behavior of the program when merging `filter` and `map`, because this expression potentially contains side effects and will only execute once
ed00b5ec 76 --> $DIR/manual_find_map.rs:25:20
add651ee
FG
77 |
78LL | .find(|&x| to_ref(to_res(x)).is_ok())
79 | ^^^^^^^^^^^^^^^^^
064997fb
FG
80
81error: `find(..).map(..)` can be simplified as `find_map(..)`
ed00b5ec 82 --> $DIR/manual_find_map.rs:28:10
064997fb
FG
83 |
84LL | .find(|x| to_ref(to_res(*x)).is_ok())
85 | __________^
86LL | | .map(|y| to_ref(to_res(y)).unwrap());
87 | |____________________________________________^ help: try: `find_map(|y| to_ref(to_res(y)).ok())`
add651ee
FG
88 |
89note: the suggestion might change the behavior of the program when merging `filter` and `map`, because this expression potentially contains side effects and will only execute once
ed00b5ec 90 --> $DIR/manual_find_map.rs:28:19
add651ee
FG
91 |
92LL | .find(|x| to_ref(to_res(*x)).is_ok())
93 | ^^^^^^^^^^^^^^^^^^
064997fb
FG
94
95error: `find(..).map(..)` can be simplified as `find_map(..)`
ed00b5ec 96 --> $DIR/manual_find_map.rs:34:26
064997fb
FG
97 |
98LL | iter::<Option<u8>>().find(|x| x.is_some()).map(|x| x.unwrap());
99 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `find_map(|x| x)`
100
101error: `find(..).map(..)` can be simplified as `find_map(..)`
ed00b5ec 102 --> $DIR/manual_find_map.rs:35:27
064997fb
FG
103 |
104LL | iter::<&Option<u8>>().find(|x| x.is_some()).map(|x| x.unwrap());
105 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `find_map(|x| *x)`
106
107error: `find(..).map(..)` can be simplified as `find_map(..)`
ed00b5ec 108 --> $DIR/manual_find_map.rs:36:28
064997fb
FG
109 |
110LL | iter::<&&Option<u8>>().find(|x| x.is_some()).map(|x| x.unwrap());
111 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `find_map(|x| **x)`
112
113error: `find(..).map(..)` can be simplified as `find_map(..)`
ed00b5ec 114 --> $DIR/manual_find_map.rs:37:27
064997fb
FG
115 |
116LL | iter::<Option<&u8>>().find(|x| x.is_some()).map(|x| x.cloned().unwrap());
117 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `find_map(|x| x.cloned())`
118
119error: `find(..).map(..)` can be simplified as `find_map(..)`
ed00b5ec 120 --> $DIR/manual_find_map.rs:38:28
064997fb
FG
121 |
122LL | iter::<&Option<&u8>>().find(|x| x.is_some()).map(|x| x.cloned().unwrap());
123 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `find_map(|x| x.cloned())`
124
125error: `find(..).map(..)` can be simplified as `find_map(..)`
ed00b5ec 126 --> $DIR/manual_find_map.rs:39:31
064997fb
FG
127 |
128LL | iter::<&Option<String>>().find(|x| x.is_some()).map(|x| x.as_deref().unwrap());
129 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `find_map(|x| x.as_deref())`
130
131error: `find(..).map(..)` can be simplified as `find_map(..)`
ed00b5ec 132 --> $DIR/manual_find_map.rs:40:31
064997fb
FG
133 |
134LL | iter::<Option<&String>>().find(|&x| to_ref(x).is_some()).map(|y| to_ref(y).cloned().unwrap());
135 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `find_map(|y| to_ref(y).cloned())`
add651ee
FG
136 |
137note: the suggestion might change the behavior of the program when merging `filter` and `map`, because this expression potentially contains side effects and will only execute once
ed00b5ec 138 --> $DIR/manual_find_map.rs:40:41
add651ee
FG
139 |
140LL | iter::<Option<&String>>().find(|&x| to_ref(x).is_some()).map(|y| to_ref(y).cloned().unwrap());
141 | ^^^^^^^^^
064997fb
FG
142
143error: `find(..).map(..)` can be simplified as `find_map(..)`
ed00b5ec 144 --> $DIR/manual_find_map.rs:42:30
064997fb
FG
145 |
146LL | iter::<Result<u8, ()>>().find(|x| x.is_ok()).map(|x| x.unwrap());
147 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `find_map(|x| x.ok())`
148
149error: `find(..).map(..)` can be simplified as `find_map(..)`
ed00b5ec 150 --> $DIR/manual_find_map.rs:43:31
064997fb
FG
151 |
152LL | iter::<&Result<u8, ()>>().find(|x| x.is_ok()).map(|x| x.unwrap());
153 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `find_map(|x| x.ok())`
154
155error: `find(..).map(..)` can be simplified as `find_map(..)`
ed00b5ec 156 --> $DIR/manual_find_map.rs:44:32
064997fb
FG
157 |
158LL | iter::<&&Result<u8, ()>>().find(|x| x.is_ok()).map(|x| x.unwrap());
159 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `find_map(|x| x.ok())`
160
161error: `find(..).map(..)` can be simplified as `find_map(..)`
ed00b5ec 162 --> $DIR/manual_find_map.rs:45:31
064997fb
FG
163 |
164LL | iter::<Result<&u8, ()>>().find(|x| x.is_ok()).map(|x| x.cloned().unwrap());
165 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `find_map(|x| x.cloned().ok())`
166
167error: `find(..).map(..)` can be simplified as `find_map(..)`
ed00b5ec 168 --> $DIR/manual_find_map.rs:46:32
064997fb
FG
169 |
170LL | iter::<&Result<&u8, ()>>().find(|x| x.is_ok()).map(|x| x.cloned().unwrap());
171 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `find_map(|x| x.cloned().ok())`
172
173error: `find(..).map(..)` can be simplified as `find_map(..)`
ed00b5ec 174 --> $DIR/manual_find_map.rs:47:35
064997fb
FG
175 |
176LL | iter::<&Result<String, ()>>().find(|x| x.is_ok()).map(|x| x.as_deref().unwrap());
177 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `find_map(|x| x.as_deref().ok())`
178
179error: `find(..).map(..)` can be simplified as `find_map(..)`
ed00b5ec 180 --> $DIR/manual_find_map.rs:48:35
064997fb
FG
181 |
182LL | iter::<Result<&String, ()>>().find(|&x| to_ref(x).is_ok()).map(|y| to_ref(y).cloned().unwrap());
183 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `find_map(|y| to_ref(y).cloned().ok())`
add651ee
FG
184 |
185note: the suggestion might change the behavior of the program when merging `filter` and `map`, because this expression potentially contains side effects and will only execute once
ed00b5ec 186 --> $DIR/manual_find_map.rs:48:45
add651ee
FG
187 |
188LL | iter::<Result<&String, ()>>().find(|&x| to_ref(x).is_ok()).map(|y| to_ref(y).cloned().unwrap());
189 | ^^^^^^^^^
064997fb
FG
190
191error: `find(..).map(..)` can be simplified as `find_map(..)`
ed00b5ec 192 --> $DIR/manual_find_map.rs:96:10
923072b8
FG
193 |
194LL | .find(|f| f.option_field.is_some())
195 | __________^
196LL | | .map(|f| f.option_field.clone().unwrap());
197 | |_________________________________________________^ help: try: `find_map(|f| f.option_field.clone())`
198
199error: `find(..).map(..)` can be simplified as `find_map(..)`
ed00b5ec 200 --> $DIR/manual_find_map.rs:101:10
923072b8
FG
201 |
202LL | .find(|f| f.ref_field.is_some())
203 | __________^
204LL | | .map(|f| f.ref_field.cloned().unwrap());
205 | |_______________________________________________^ help: try: `find_map(|f| f.ref_field.cloned())`
206
207error: `find(..).map(..)` can be simplified as `find_map(..)`
ed00b5ec 208 --> $DIR/manual_find_map.rs:106:10
923072b8
FG
209 |
210LL | .find(|f| f.ref_field.is_some())
211 | __________^
212LL | | .map(|f| f.ref_field.copied().unwrap());
213 | |_______________________________________________^ help: try: `find_map(|f| f.ref_field.copied())`
214
215error: `find(..).map(..)` can be simplified as `find_map(..)`
ed00b5ec 216 --> $DIR/manual_find_map.rs:111:10
923072b8
FG
217 |
218LL | .find(|f| f.result_field.is_ok())
219 | __________^
220LL | | .map(|f| f.result_field.clone().unwrap());
221 | |_________________________________________________^ help: try: `find_map(|f| f.result_field.clone().ok())`
222
223error: `find(..).map(..)` can be simplified as `find_map(..)`
ed00b5ec 224 --> $DIR/manual_find_map.rs:116:10
923072b8
FG
225 |
226LL | .find(|f| f.result_field.is_ok())
227 | __________^
228LL | | .map(|f| f.result_field.as_ref().unwrap());
229 | |__________________________________________________^ help: try: `find_map(|f| f.result_field.as_ref().ok())`
230
231error: `find(..).map(..)` can be simplified as `find_map(..)`
ed00b5ec 232 --> $DIR/manual_find_map.rs:121:10
923072b8
FG
233 |
234LL | .find(|f| f.result_field.is_ok())
235 | __________^
236LL | | .map(|f| f.result_field.as_deref().unwrap());
237 | |____________________________________________________^ help: try: `find_map(|f| f.result_field.as_deref().ok())`
238
239error: `find(..).map(..)` can be simplified as `find_map(..)`
ed00b5ec 240 --> $DIR/manual_find_map.rs:126:10
923072b8
FG
241 |
242LL | .find(|f| f.result_field.is_ok())
243 | __________^
244LL | | .map(|f| f.result_field.as_mut().unwrap());
245 | |__________________________________________________^ help: try: `find_map(|f| f.result_field.as_mut().ok())`
246
247error: `find(..).map(..)` can be simplified as `find_map(..)`
ed00b5ec 248 --> $DIR/manual_find_map.rs:131:10
923072b8
FG
249 |
250LL | .find(|f| f.result_field.is_ok())
251 | __________^
252LL | | .map(|f| f.result_field.as_deref_mut().unwrap());
253 | |________________________________________________________^ help: try: `find_map(|f| f.result_field.as_deref_mut().ok())`
254
255error: `find(..).map(..)` can be simplified as `find_map(..)`
ed00b5ec 256 --> $DIR/manual_find_map.rs:136:10
923072b8
FG
257 |
258LL | .find(|f| f.result_field.is_ok())
259 | __________^
260LL | | .map(|f| f.result_field.to_owned().unwrap());
261 | |____________________________________________________^ help: try: `find_map(|f| f.result_field.to_owned().ok())`
262
064997fb 263error: aborting due to 30 previous errors
f20569fa 264