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