]> git.lizzy.rs Git - rust.git/blob - tests/ui/manual_find_map.stderr
Auto merge of #9684 - kraktus:ref_option_ref, r=xFrednet
[rust.git] / tests / ui / manual_find_map.stderr
1 error: `find(..).map(..)` can be simplified as `find_map(..)`
2   --> $DIR/manual_find_map.rs:8:19
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    |
7    = note: `-D clippy::manual-find-map` implied by `-D warnings`
8
9 error: `find(..).map(..)` can be simplified as `find_map(..)`
10   --> $DIR/manual_find_map.rs:11:19
11    |
12 LL |     let _ = (0..).find(|&n| to_opt(n).is_some()).map(|a| to_opt(a).expect("hi"));
13    |                   ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `find_map(|a| to_opt(a))`
14
15 error: `find(..).map(..)` can be simplified as `find_map(..)`
16   --> $DIR/manual_find_map.rs:14:19
17    |
18 LL |     let _ = (0..).find(|&n| to_res(n).is_ok()).map(|a| to_res(a).unwrap_or(1));
19    |                   ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `find_map(|a| to_res(a).ok())`
20
21 error: `find(..).map(..)` can be simplified as `find_map(..)`
22   --> $DIR/manual_find_map.rs:17:10
23    |
24 LL |           .find(|&x| to_ref(to_opt(x)).is_some())
25    |  __________^
26 LL | |         .map(|y| to_ref(to_opt(y)).unwrap());
27    | |____________________________________________^ help: try: `find_map(|y| *to_ref(to_opt(y)))`
28
29 error: `find(..).map(..)` can be simplified as `find_map(..)`
30   --> $DIR/manual_find_map.rs:20:10
31    |
32 LL |           .find(|x| to_ref(to_opt(*x)).is_some())
33    |  __________^
34 LL | |         .map(|y| to_ref(to_opt(y)).unwrap());
35    | |____________________________________________^ help: try: `find_map(|y| *to_ref(to_opt(y)))`
36
37 error: `find(..).map(..)` can be simplified as `find_map(..)`
38   --> $DIR/manual_find_map.rs:24:10
39    |
40 LL |           .find(|&x| to_ref(to_res(x)).is_ok())
41    |  __________^
42 LL | |         .map(|y| to_ref(to_res(y)).unwrap());
43    | |____________________________________________^ help: try: `find_map(|y| to_ref(to_res(y)).ok())`
44
45 error: `find(..).map(..)` can be simplified as `find_map(..)`
46   --> $DIR/manual_find_map.rs:27:10
47    |
48 LL |           .find(|x| to_ref(to_res(*x)).is_ok())
49    |  __________^
50 LL | |         .map(|y| to_ref(to_res(y)).unwrap());
51    | |____________________________________________^ help: try: `find_map(|y| to_ref(to_res(y)).ok())`
52
53 error: `find(..).map(..)` can be simplified as `find_map(..)`
54   --> $DIR/manual_find_map.rs:33:26
55    |
56 LL |     iter::<Option<u8>>().find(|x| x.is_some()).map(|x| x.unwrap());
57    |                          ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `find_map(|x| x)`
58
59 error: `find(..).map(..)` can be simplified as `find_map(..)`
60   --> $DIR/manual_find_map.rs:34:27
61    |
62 LL |     iter::<&Option<u8>>().find(|x| x.is_some()).map(|x| x.unwrap());
63    |                           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `find_map(|x| *x)`
64
65 error: `find(..).map(..)` can be simplified as `find_map(..)`
66   --> $DIR/manual_find_map.rs:35:28
67    |
68 LL |     iter::<&&Option<u8>>().find(|x| x.is_some()).map(|x| x.unwrap());
69    |                            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `find_map(|x| **x)`
70
71 error: `find(..).map(..)` can be simplified as `find_map(..)`
72   --> $DIR/manual_find_map.rs:36:27
73    |
74 LL |     iter::<Option<&u8>>().find(|x| x.is_some()).map(|x| x.cloned().unwrap());
75    |                           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `find_map(|x| x.cloned())`
76
77 error: `find(..).map(..)` can be simplified as `find_map(..)`
78   --> $DIR/manual_find_map.rs:37:28
79    |
80 LL |     iter::<&Option<&u8>>().find(|x| x.is_some()).map(|x| x.cloned().unwrap());
81    |                            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `find_map(|x| x.cloned())`
82
83 error: `find(..).map(..)` can be simplified as `find_map(..)`
84   --> $DIR/manual_find_map.rs:38:31
85    |
86 LL |     iter::<&Option<String>>().find(|x| x.is_some()).map(|x| x.as_deref().unwrap());
87    |                               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `find_map(|x| x.as_deref())`
88
89 error: `find(..).map(..)` can be simplified as `find_map(..)`
90   --> $DIR/manual_find_map.rs:39:31
91    |
92 LL |     iter::<Option<&String>>().find(|&x| to_ref(x).is_some()).map(|y| to_ref(y).cloned().unwrap());
93    |                               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `find_map(|y| to_ref(y).cloned())`
94
95 error: `find(..).map(..)` can be simplified as `find_map(..)`
96   --> $DIR/manual_find_map.rs:41:30
97    |
98 LL |     iter::<Result<u8, ()>>().find(|x| x.is_ok()).map(|x| x.unwrap());
99    |                              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `find_map(|x| x.ok())`
100
101 error: `find(..).map(..)` can be simplified as `find_map(..)`
102   --> $DIR/manual_find_map.rs:42:31
103    |
104 LL |     iter::<&Result<u8, ()>>().find(|x| x.is_ok()).map(|x| x.unwrap());
105    |                               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `find_map(|x| x.ok())`
106
107 error: `find(..).map(..)` can be simplified as `find_map(..)`
108   --> $DIR/manual_find_map.rs:43:32
109    |
110 LL |     iter::<&&Result<u8, ()>>().find(|x| x.is_ok()).map(|x| x.unwrap());
111    |                                ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `find_map(|x| x.ok())`
112
113 error: `find(..).map(..)` can be simplified as `find_map(..)`
114   --> $DIR/manual_find_map.rs:44:31
115    |
116 LL |     iter::<Result<&u8, ()>>().find(|x| x.is_ok()).map(|x| x.cloned().unwrap());
117    |                               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `find_map(|x| x.cloned().ok())`
118
119 error: `find(..).map(..)` can be simplified as `find_map(..)`
120   --> $DIR/manual_find_map.rs:45:32
121    |
122 LL |     iter::<&Result<&u8, ()>>().find(|x| x.is_ok()).map(|x| x.cloned().unwrap());
123    |                                ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `find_map(|x| x.cloned().ok())`
124
125 error: `find(..).map(..)` can be simplified as `find_map(..)`
126   --> $DIR/manual_find_map.rs:46:35
127    |
128 LL |     iter::<&Result<String, ()>>().find(|x| x.is_ok()).map(|x| x.as_deref().unwrap());
129    |                                   ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `find_map(|x| x.as_deref().ok())`
130
131 error: `find(..).map(..)` can be simplified as `find_map(..)`
132   --> $DIR/manual_find_map.rs:47:35
133    |
134 LL |     iter::<Result<&String, ()>>().find(|&x| to_ref(x).is_ok()).map(|y| to_ref(y).cloned().unwrap());
135    |                                   ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `find_map(|y| to_ref(y).cloned().ok())`
136
137 error: `find(..).map(..)` can be simplified as `find_map(..)`
138   --> $DIR/manual_find_map.rs:95:10
139    |
140 LL |           .find(|f| f.option_field.is_some())
141    |  __________^
142 LL | |         .map(|f| f.option_field.clone().unwrap());
143    | |_________________________________________________^ help: try: `find_map(|f| f.option_field.clone())`
144
145 error: `find(..).map(..)` can be simplified as `find_map(..)`
146   --> $DIR/manual_find_map.rs:100:10
147    |
148 LL |           .find(|f| f.ref_field.is_some())
149    |  __________^
150 LL | |         .map(|f| f.ref_field.cloned().unwrap());
151    | |_______________________________________________^ help: try: `find_map(|f| f.ref_field.cloned())`
152
153 error: `find(..).map(..)` can be simplified as `find_map(..)`
154   --> $DIR/manual_find_map.rs:105:10
155    |
156 LL |           .find(|f| f.ref_field.is_some())
157    |  __________^
158 LL | |         .map(|f| f.ref_field.copied().unwrap());
159    | |_______________________________________________^ help: try: `find_map(|f| f.ref_field.copied())`
160
161 error: `find(..).map(..)` can be simplified as `find_map(..)`
162   --> $DIR/manual_find_map.rs:110:10
163    |
164 LL |           .find(|f| f.result_field.is_ok())
165    |  __________^
166 LL | |         .map(|f| f.result_field.clone().unwrap());
167    | |_________________________________________________^ help: try: `find_map(|f| f.result_field.clone().ok())`
168
169 error: `find(..).map(..)` can be simplified as `find_map(..)`
170   --> $DIR/manual_find_map.rs:115:10
171    |
172 LL |           .find(|f| f.result_field.is_ok())
173    |  __________^
174 LL | |         .map(|f| f.result_field.as_ref().unwrap());
175    | |__________________________________________________^ help: try: `find_map(|f| f.result_field.as_ref().ok())`
176
177 error: `find(..).map(..)` can be simplified as `find_map(..)`
178   --> $DIR/manual_find_map.rs:120:10
179    |
180 LL |           .find(|f| f.result_field.is_ok())
181    |  __________^
182 LL | |         .map(|f| f.result_field.as_deref().unwrap());
183    | |____________________________________________________^ help: try: `find_map(|f| f.result_field.as_deref().ok())`
184
185 error: `find(..).map(..)` can be simplified as `find_map(..)`
186   --> $DIR/manual_find_map.rs:125:10
187    |
188 LL |           .find(|f| f.result_field.is_ok())
189    |  __________^
190 LL | |         .map(|f| f.result_field.as_mut().unwrap());
191    | |__________________________________________________^ help: try: `find_map(|f| f.result_field.as_mut().ok())`
192
193 error: `find(..).map(..)` can be simplified as `find_map(..)`
194   --> $DIR/manual_find_map.rs:130:10
195    |
196 LL |           .find(|f| f.result_field.is_ok())
197    |  __________^
198 LL | |         .map(|f| f.result_field.as_deref_mut().unwrap());
199    | |________________________________________________________^ help: try: `find_map(|f| f.result_field.as_deref_mut().ok())`
200
201 error: `find(..).map(..)` can be simplified as `find_map(..)`
202   --> $DIR/manual_find_map.rs:135:10
203    |
204 LL |           .find(|f| f.result_field.is_ok())
205    |  __________^
206 LL | |         .map(|f| f.result_field.to_owned().unwrap());
207    | |____________________________________________________^ help: try: `find_map(|f| f.result_field.to_owned().ok())`
208
209 error: aborting due to 30 previous errors
210