]>
Commit | Line | Data |
---|---|---|
f20569fa | 1 | error: `find(..).map(..)` can be simplified as `find_map(..)` |
ed00b5ec | 2 | --> $DIR/manual_find_map.rs:9:19 |
f20569fa XL |
3 | | |
4 | LL | 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 | 7 | note: 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 | | |
10 | LL | 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 | |
15 | error: `find(..).map(..)` can be simplified as `find_map(..)` | |
ed00b5ec | 16 | --> $DIR/manual_find_map.rs:12:19 |
f20569fa XL |
17 | | |
18 | LL | 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 | | |
21 | note: 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 | | |
24 | LL | let _ = (0..).find(|&n| to_opt(n).is_some()).map(|a| to_opt(a).expect("hi")); | |
25 | | ^^^^^^^^^ | |
f20569fa XL |
26 | |
27 | error: `find(..).map(..)` can be simplified as `find_map(..)` | |
ed00b5ec | 28 | --> $DIR/manual_find_map.rs:15:19 |
f20569fa XL |
29 | | |
30 | LL | 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 | | |
33 | note: 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 | | |
36 | LL | let _ = (0..).find(|&n| to_res(n).is_ok()).map(|a| to_res(a).unwrap_or(1)); | |
37 | | ^^^^^^^^^ | |
f20569fa | 38 | |
923072b8 | 39 | error: `find(..).map(..)` can be simplified as `find_map(..)` |
ed00b5ec | 40 | --> $DIR/manual_find_map.rs:18:10 |
064997fb FG |
41 | | |
42 | LL | .find(|&x| to_ref(to_opt(x)).is_some()) | |
43 | | __________^ | |
44 | LL | | .map(|y| to_ref(to_opt(y)).unwrap()); | |
45 | | |____________________________________________^ help: try: `find_map(|y| *to_ref(to_opt(y)))` | |
add651ee FG |
46 | | |
47 | note: 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 | | |
50 | LL | .find(|&x| to_ref(to_opt(x)).is_some()) | |
51 | | ^^^^^^^^^^^^^^^^^ | |
064997fb FG |
52 | |
53 | error: `find(..).map(..)` can be simplified as `find_map(..)` | |
ed00b5ec | 54 | --> $DIR/manual_find_map.rs:21:10 |
064997fb FG |
55 | | |
56 | LL | .find(|x| to_ref(to_opt(*x)).is_some()) | |
57 | | __________^ | |
58 | LL | | .map(|y| to_ref(to_opt(y)).unwrap()); | |
59 | | |____________________________________________^ help: try: `find_map(|y| *to_ref(to_opt(y)))` | |
add651ee FG |
60 | | |
61 | note: 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 | | |
64 | LL | .find(|x| to_ref(to_opt(*x)).is_some()) | |
65 | | ^^^^^^^^^^^^^^^^^^ | |
064997fb FG |
66 | |
67 | error: `find(..).map(..)` can be simplified as `find_map(..)` | |
ed00b5ec | 68 | --> $DIR/manual_find_map.rs:25:10 |
064997fb FG |
69 | | |
70 | LL | .find(|&x| to_ref(to_res(x)).is_ok()) | |
71 | | __________^ | |
72 | LL | | .map(|y| to_ref(to_res(y)).unwrap()); | |
73 | | |____________________________________________^ help: try: `find_map(|y| to_ref(to_res(y)).ok())` | |
add651ee FG |
74 | | |
75 | note: 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 | | |
78 | LL | .find(|&x| to_ref(to_res(x)).is_ok()) | |
79 | | ^^^^^^^^^^^^^^^^^ | |
064997fb FG |
80 | |
81 | error: `find(..).map(..)` can be simplified as `find_map(..)` | |
ed00b5ec | 82 | --> $DIR/manual_find_map.rs:28:10 |
064997fb FG |
83 | | |
84 | LL | .find(|x| to_ref(to_res(*x)).is_ok()) | |
85 | | __________^ | |
86 | LL | | .map(|y| to_ref(to_res(y)).unwrap()); | |
87 | | |____________________________________________^ help: try: `find_map(|y| to_ref(to_res(y)).ok())` | |
add651ee FG |
88 | | |
89 | note: 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 | | |
92 | LL | .find(|x| to_ref(to_res(*x)).is_ok()) | |
93 | | ^^^^^^^^^^^^^^^^^^ | |
064997fb FG |
94 | |
95 | error: `find(..).map(..)` can be simplified as `find_map(..)` | |
ed00b5ec | 96 | --> $DIR/manual_find_map.rs:34:26 |
064997fb FG |
97 | | |
98 | LL | iter::<Option<u8>>().find(|x| x.is_some()).map(|x| x.unwrap()); | |
99 | | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `find_map(|x| x)` | |
100 | ||
101 | error: `find(..).map(..)` can be simplified as `find_map(..)` | |
ed00b5ec | 102 | --> $DIR/manual_find_map.rs:35:27 |
064997fb FG |
103 | | |
104 | LL | iter::<&Option<u8>>().find(|x| x.is_some()).map(|x| x.unwrap()); | |
105 | | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `find_map(|x| *x)` | |
106 | ||
107 | error: `find(..).map(..)` can be simplified as `find_map(..)` | |
ed00b5ec | 108 | --> $DIR/manual_find_map.rs:36:28 |
064997fb FG |
109 | | |
110 | LL | iter::<&&Option<u8>>().find(|x| x.is_some()).map(|x| x.unwrap()); | |
111 | | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `find_map(|x| **x)` | |
112 | ||
113 | error: `find(..).map(..)` can be simplified as `find_map(..)` | |
ed00b5ec | 114 | --> $DIR/manual_find_map.rs:37:27 |
064997fb FG |
115 | | |
116 | LL | iter::<Option<&u8>>().find(|x| x.is_some()).map(|x| x.cloned().unwrap()); | |
117 | | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `find_map(|x| x.cloned())` | |
118 | ||
119 | error: `find(..).map(..)` can be simplified as `find_map(..)` | |
ed00b5ec | 120 | --> $DIR/manual_find_map.rs:38:28 |
064997fb FG |
121 | | |
122 | LL | iter::<&Option<&u8>>().find(|x| x.is_some()).map(|x| x.cloned().unwrap()); | |
123 | | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `find_map(|x| x.cloned())` | |
124 | ||
125 | error: `find(..).map(..)` can be simplified as `find_map(..)` | |
ed00b5ec | 126 | --> $DIR/manual_find_map.rs:39:31 |
064997fb FG |
127 | | |
128 | LL | iter::<&Option<String>>().find(|x| x.is_some()).map(|x| x.as_deref().unwrap()); | |
129 | | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `find_map(|x| x.as_deref())` | |
130 | ||
131 | error: `find(..).map(..)` can be simplified as `find_map(..)` | |
ed00b5ec | 132 | --> $DIR/manual_find_map.rs:40:31 |
064997fb FG |
133 | | |
134 | LL | 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 | | |
137 | note: 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 | | |
140 | LL | iter::<Option<&String>>().find(|&x| to_ref(x).is_some()).map(|y| to_ref(y).cloned().unwrap()); | |
141 | | ^^^^^^^^^ | |
064997fb FG |
142 | |
143 | error: `find(..).map(..)` can be simplified as `find_map(..)` | |
ed00b5ec | 144 | --> $DIR/manual_find_map.rs:42:30 |
064997fb FG |
145 | | |
146 | LL | iter::<Result<u8, ()>>().find(|x| x.is_ok()).map(|x| x.unwrap()); | |
147 | | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `find_map(|x| x.ok())` | |
148 | ||
149 | error: `find(..).map(..)` can be simplified as `find_map(..)` | |
ed00b5ec | 150 | --> $DIR/manual_find_map.rs:43:31 |
064997fb FG |
151 | | |
152 | LL | iter::<&Result<u8, ()>>().find(|x| x.is_ok()).map(|x| x.unwrap()); | |
153 | | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `find_map(|x| x.ok())` | |
154 | ||
155 | error: `find(..).map(..)` can be simplified as `find_map(..)` | |
ed00b5ec | 156 | --> $DIR/manual_find_map.rs:44:32 |
064997fb FG |
157 | | |
158 | LL | iter::<&&Result<u8, ()>>().find(|x| x.is_ok()).map(|x| x.unwrap()); | |
159 | | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `find_map(|x| x.ok())` | |
160 | ||
161 | error: `find(..).map(..)` can be simplified as `find_map(..)` | |
ed00b5ec | 162 | --> $DIR/manual_find_map.rs:45:31 |
064997fb FG |
163 | | |
164 | LL | iter::<Result<&u8, ()>>().find(|x| x.is_ok()).map(|x| x.cloned().unwrap()); | |
165 | | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `find_map(|x| x.cloned().ok())` | |
166 | ||
167 | error: `find(..).map(..)` can be simplified as `find_map(..)` | |
ed00b5ec | 168 | --> $DIR/manual_find_map.rs:46:32 |
064997fb FG |
169 | | |
170 | LL | iter::<&Result<&u8, ()>>().find(|x| x.is_ok()).map(|x| x.cloned().unwrap()); | |
171 | | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `find_map(|x| x.cloned().ok())` | |
172 | ||
173 | error: `find(..).map(..)` can be simplified as `find_map(..)` | |
ed00b5ec | 174 | --> $DIR/manual_find_map.rs:47:35 |
064997fb FG |
175 | | |
176 | LL | 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 | ||
179 | error: `find(..).map(..)` can be simplified as `find_map(..)` | |
ed00b5ec | 180 | --> $DIR/manual_find_map.rs:48:35 |
064997fb FG |
181 | | |
182 | LL | 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 | | |
185 | note: 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 | | |
188 | LL | iter::<Result<&String, ()>>().find(|&x| to_ref(x).is_ok()).map(|y| to_ref(y).cloned().unwrap()); | |
189 | | ^^^^^^^^^ | |
064997fb FG |
190 | |
191 | error: `find(..).map(..)` can be simplified as `find_map(..)` | |
ed00b5ec | 192 | --> $DIR/manual_find_map.rs:96:10 |
923072b8 FG |
193 | | |
194 | LL | .find(|f| f.option_field.is_some()) | |
195 | | __________^ | |
196 | LL | | .map(|f| f.option_field.clone().unwrap()); | |
197 | | |_________________________________________________^ help: try: `find_map(|f| f.option_field.clone())` | |
198 | ||
199 | error: `find(..).map(..)` can be simplified as `find_map(..)` | |
ed00b5ec | 200 | --> $DIR/manual_find_map.rs:101:10 |
923072b8 FG |
201 | | |
202 | LL | .find(|f| f.ref_field.is_some()) | |
203 | | __________^ | |
204 | LL | | .map(|f| f.ref_field.cloned().unwrap()); | |
205 | | |_______________________________________________^ help: try: `find_map(|f| f.ref_field.cloned())` | |
206 | ||
207 | error: `find(..).map(..)` can be simplified as `find_map(..)` | |
ed00b5ec | 208 | --> $DIR/manual_find_map.rs:106:10 |
923072b8 FG |
209 | | |
210 | LL | .find(|f| f.ref_field.is_some()) | |
211 | | __________^ | |
212 | LL | | .map(|f| f.ref_field.copied().unwrap()); | |
213 | | |_______________________________________________^ help: try: `find_map(|f| f.ref_field.copied())` | |
214 | ||
215 | error: `find(..).map(..)` can be simplified as `find_map(..)` | |
ed00b5ec | 216 | --> $DIR/manual_find_map.rs:111:10 |
923072b8 FG |
217 | | |
218 | LL | .find(|f| f.result_field.is_ok()) | |
219 | | __________^ | |
220 | LL | | .map(|f| f.result_field.clone().unwrap()); | |
221 | | |_________________________________________________^ help: try: `find_map(|f| f.result_field.clone().ok())` | |
222 | ||
223 | error: `find(..).map(..)` can be simplified as `find_map(..)` | |
ed00b5ec | 224 | --> $DIR/manual_find_map.rs:116:10 |
923072b8 FG |
225 | | |
226 | LL | .find(|f| f.result_field.is_ok()) | |
227 | | __________^ | |
228 | LL | | .map(|f| f.result_field.as_ref().unwrap()); | |
229 | | |__________________________________________________^ help: try: `find_map(|f| f.result_field.as_ref().ok())` | |
230 | ||
231 | error: `find(..).map(..)` can be simplified as `find_map(..)` | |
ed00b5ec | 232 | --> $DIR/manual_find_map.rs:121:10 |
923072b8 FG |
233 | | |
234 | LL | .find(|f| f.result_field.is_ok()) | |
235 | | __________^ | |
236 | LL | | .map(|f| f.result_field.as_deref().unwrap()); | |
237 | | |____________________________________________________^ help: try: `find_map(|f| f.result_field.as_deref().ok())` | |
238 | ||
239 | error: `find(..).map(..)` can be simplified as `find_map(..)` | |
ed00b5ec | 240 | --> $DIR/manual_find_map.rs:126:10 |
923072b8 FG |
241 | | |
242 | LL | .find(|f| f.result_field.is_ok()) | |
243 | | __________^ | |
244 | LL | | .map(|f| f.result_field.as_mut().unwrap()); | |
245 | | |__________________________________________________^ help: try: `find_map(|f| f.result_field.as_mut().ok())` | |
246 | ||
247 | error: `find(..).map(..)` can be simplified as `find_map(..)` | |
ed00b5ec | 248 | --> $DIR/manual_find_map.rs:131:10 |
923072b8 FG |
249 | | |
250 | LL | .find(|f| f.result_field.is_ok()) | |
251 | | __________^ | |
252 | LL | | .map(|f| f.result_field.as_deref_mut().unwrap()); | |
253 | | |________________________________________________________^ help: try: `find_map(|f| f.result_field.as_deref_mut().ok())` | |
254 | ||
255 | error: `find(..).map(..)` can be simplified as `find_map(..)` | |
ed00b5ec | 256 | --> $DIR/manual_find_map.rs:136:10 |
923072b8 FG |
257 | | |
258 | LL | .find(|f| f.result_field.is_ok()) | |
259 | | __________^ | |
260 | LL | | .map(|f| f.result_field.to_owned().unwrap()); | |
261 | | |____________________________________________________^ help: try: `find_map(|f| f.result_field.to_owned().ok())` | |
262 | ||
064997fb | 263 | error: aborting due to 30 previous errors |
f20569fa | 264 |