1 error: `filter(..).map(..)` can be simplified as `filter_map(..)`
2 --> $DIR/manual_filter_map.rs:8:19
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))`
7 = note: `-D clippy::manual-filter-map` implied by `-D warnings`
9 error: `filter(..).map(..)` can be simplified as `filter_map(..)`
10 --> $DIR/manual_filter_map.rs:11:19
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))`
15 error: `filter(..).map(..)` can be simplified as `filter_map(..)`
16 --> $DIR/manual_filter_map.rs:14:19
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())`
21 error: `filter(..).map(..)` can be simplified as `filter_map(..)`
22 --> $DIR/manual_filter_map.rs:17:10
24 LL | .filter(|&x| to_ref(to_opt(x)).is_some())
26 LL | | .map(|y| to_ref(to_opt(y)).unwrap());
27 | |____________________________________________^ help: try: `filter_map(|y| *to_ref(to_opt(y)))`
29 error: `filter(..).map(..)` can be simplified as `filter_map(..)`
30 --> $DIR/manual_filter_map.rs:20:10
32 LL | .filter(|x| to_ref(to_opt(*x)).is_some())
34 LL | | .map(|y| to_ref(to_opt(y)).unwrap());
35 | |____________________________________________^ help: try: `filter_map(|y| *to_ref(to_opt(y)))`
37 error: `filter(..).map(..)` can be simplified as `filter_map(..)`
38 --> $DIR/manual_filter_map.rs:24:10
40 LL | .filter(|&x| to_ref(to_res(x)).is_ok())
42 LL | | .map(|y| to_ref(to_res(y)).unwrap());
43 | |____________________________________________^ help: try: `filter_map(|y| to_ref(to_res(y)).ok())`
45 error: `filter(..).map(..)` can be simplified as `filter_map(..)`
46 --> $DIR/manual_filter_map.rs:27:10
48 LL | .filter(|x| to_ref(to_res(*x)).is_ok())
50 LL | | .map(|y| to_ref(to_res(y)).unwrap());
51 | |____________________________________________^ help: try: `filter_map(|y| to_ref(to_res(y)).ok())`
53 error: `find(..).map(..)` can be simplified as `find_map(..)`
54 --> $DIR/manual_filter_map.rs:33:27
56 LL | iter::<Option<&u8>>().find(|x| x.is_some()).map(|x| x.cloned().unwrap());
57 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `find_map(|x| x.cloned())`
59 = note: `-D clippy::manual-find-map` implied by `-D warnings`
61 error: `find(..).map(..)` can be simplified as `find_map(..)`
62 --> $DIR/manual_filter_map.rs:34:28
64 LL | iter::<&Option<&u8>>().find(|x| x.is_some()).map(|x| x.cloned().unwrap());
65 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `find_map(|x| x.cloned())`
67 error: `find(..).map(..)` can be simplified as `find_map(..)`
68 --> $DIR/manual_filter_map.rs:35:31
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())`
73 error: `find(..).map(..)` can be simplified as `find_map(..)`
74 --> $DIR/manual_filter_map.rs:36:31
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())`
79 error: `find(..).map(..)` can be simplified as `find_map(..)`
80 --> $DIR/manual_filter_map.rs:38:30
82 LL | iter::<Result<u8, ()>>().find(|x| x.is_ok()).map(|x| x.unwrap());
83 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `find_map(|x| x.ok())`
85 error: `find(..).map(..)` can be simplified as `find_map(..)`
86 --> $DIR/manual_filter_map.rs:39:31
88 LL | iter::<&Result<u8, ()>>().find(|x| x.is_ok()).map(|x| x.unwrap());
89 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `find_map(|x| x.ok())`
91 error: `find(..).map(..)` can be simplified as `find_map(..)`
92 --> $DIR/manual_filter_map.rs:40:32
94 LL | iter::<&&Result<u8, ()>>().find(|x| x.is_ok()).map(|x| x.unwrap());
95 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `find_map(|x| x.ok())`
97 error: `find(..).map(..)` can be simplified as `find_map(..)`
98 --> $DIR/manual_filter_map.rs:41:31
100 LL | iter::<Result<&u8, ()>>().find(|x| x.is_ok()).map(|x| x.cloned().unwrap());
101 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `find_map(|x| x.cloned().ok())`
103 error: `find(..).map(..)` can be simplified as `find_map(..)`
104 --> $DIR/manual_filter_map.rs:42:32
106 LL | iter::<&Result<&u8, ()>>().find(|x| x.is_ok()).map(|x| x.cloned().unwrap());
107 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `find_map(|x| x.cloned().ok())`
109 error: `find(..).map(..)` can be simplified as `find_map(..)`
110 --> $DIR/manual_filter_map.rs:43:35
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())`
115 error: `find(..).map(..)` can be simplified as `find_map(..)`
116 --> $DIR/manual_filter_map.rs:44:35
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())`
121 error: `filter(..).map(..)` can be simplified as `filter_map(..)`
122 --> $DIR/manual_filter_map.rs:92:10
124 LL | .filter(|f| f.option_field.is_some())
126 LL | | .map(|f| f.option_field.clone().unwrap());
127 | |_________________________________________________^ help: try: `filter_map(|f| f.option_field.clone())`
129 error: `filter(..).map(..)` can be simplified as `filter_map(..)`
130 --> $DIR/manual_filter_map.rs:97:10
132 LL | .filter(|f| f.ref_field.is_some())
134 LL | | .map(|f| f.ref_field.cloned().unwrap());
135 | |_______________________________________________^ help: try: `filter_map(|f| f.ref_field.cloned())`
137 error: `filter(..).map(..)` can be simplified as `filter_map(..)`
138 --> $DIR/manual_filter_map.rs:102:10
140 LL | .filter(|f| f.ref_field.is_some())
142 LL | | .map(|f| f.ref_field.copied().unwrap());
143 | |_______________________________________________^ help: try: `filter_map(|f| f.ref_field.copied())`
145 error: `filter(..).map(..)` can be simplified as `filter_map(..)`
146 --> $DIR/manual_filter_map.rs:107:10
148 LL | .filter(|f| f.result_field.is_ok())
150 LL | | .map(|f| f.result_field.clone().unwrap());
151 | |_________________________________________________^ help: try: `filter_map(|f| f.result_field.clone().ok())`
153 error: `filter(..).map(..)` can be simplified as `filter_map(..)`
154 --> $DIR/manual_filter_map.rs:112:10
156 LL | .filter(|f| f.result_field.is_ok())
158 LL | | .map(|f| f.result_field.as_ref().unwrap());
159 | |__________________________________________________^ help: try: `filter_map(|f| f.result_field.as_ref().ok())`
161 error: `filter(..).map(..)` can be simplified as `filter_map(..)`
162 --> $DIR/manual_filter_map.rs:117:10
164 LL | .filter(|f| f.result_field.is_ok())
166 LL | | .map(|f| f.result_field.as_deref().unwrap());
167 | |____________________________________________________^ help: try: `filter_map(|f| f.result_field.as_deref().ok())`
169 error: `filter(..).map(..)` can be simplified as `filter_map(..)`
170 --> $DIR/manual_filter_map.rs:122:10
172 LL | .filter(|f| f.result_field.is_ok())
174 LL | | .map(|f| f.result_field.as_mut().unwrap());
175 | |__________________________________________________^ help: try: `filter_map(|f| f.result_field.as_mut().ok())`
177 error: `filter(..).map(..)` can be simplified as `filter_map(..)`
178 --> $DIR/manual_filter_map.rs:127:10
180 LL | .filter(|f| f.result_field.is_ok())
182 LL | | .map(|f| f.result_field.as_deref_mut().unwrap());
183 | |________________________________________________________^ help: try: `filter_map(|f| f.result_field.as_deref_mut().ok())`
185 error: `filter(..).map(..)` can be simplified as `filter_map(..)`
186 --> $DIR/manual_filter_map.rs:132:10
188 LL | .filter(|f| f.result_field.is_ok())
190 LL | | .map(|f| f.result_field.to_owned().unwrap());
191 | |____________________________________________________^ help: try: `filter_map(|f| f.result_field.to_owned().ok())`
193 error: aborting due to 27 previous errors