11error: redundant closure
2- --> tests/ui/eta.rs:29 :27
2+ --> tests/ui/eta.rs:30 :27
33 |
44LL | let a = Some(1u8).map(|a| foo(a));
55 | ^^^^^^^^^^ help: replace the closure with the function itself: `foo`
@@ -8,31 +8,31 @@ LL | let a = Some(1u8).map(|a| foo(a));
88 = help: to override `-D warnings` add `#[allow(clippy::redundant_closure)]`
99
1010error: redundant closure
11- --> tests/ui/eta.rs:33 :40
11+ --> tests/ui/eta.rs:34 :40
1212 |
1313LL | let _: Option<Vec<u8>> = true.then(|| vec![]); // special case vec!
1414 | ^^^^^^^^^ help: replace the closure with `Vec::new`: `std::vec::Vec::new`
1515
1616error: redundant closure
17- --> tests/ui/eta.rs:34 :35
17+ --> tests/ui/eta.rs:35 :35
1818 |
1919LL | let d = Some(1u8).map(|a| foo((|b| foo2(b))(a))); //is adjusted?
2020 | ^^^^^^^^^^^^^ help: replace the closure with the function itself: `foo2`
2121
2222error: redundant closure
23- --> tests/ui/eta.rs:35 :26
23+ --> tests/ui/eta.rs:36 :26
2424 |
2525LL | all(&[1, 2, 3], &&2, |x, y| below(x, y)); //is adjusted
2626 | ^^^^^^^^^^^^^^^^^^ help: replace the closure with the function itself: `below`
2727
2828error: redundant closure
29- --> tests/ui/eta.rs:42 :27
29+ --> tests/ui/eta.rs:43 :27
3030 |
3131LL | let e = Some(1u8).map(|a| generic(a));
3232 | ^^^^^^^^^^^^^^ help: replace the closure with the function itself: `generic`
3333
3434error: redundant closure
35- --> tests/ui/eta.rs:94 :51
35+ --> tests/ui/eta.rs:95 :51
3636 |
3737LL | let e = Some(TestStruct { some_ref: &i }).map(|a| a.foo());
3838 | ^^^^^^^^^^^ help: replace the closure with the method itself: `TestStruct::foo`
@@ -41,166 +41,184 @@ LL | let e = Some(TestStruct { some_ref: &i }).map(|a| a.foo());
4141 = help: to override `-D warnings` add `#[allow(clippy::redundant_closure_for_method_calls)]`
4242
4343error: redundant closure
44- --> tests/ui/eta.rs:95 :51
44+ --> tests/ui/eta.rs:96 :51
4545 |
4646LL | let e = Some(TestStruct { some_ref: &i }).map(|a| a.trait_foo());
4747 | ^^^^^^^^^^^^^^^^^ help: replace the closure with the method itself: `TestTrait::trait_foo`
4848
4949error: redundant closure
50- --> tests/ui/eta.rs:97 :42
50+ --> tests/ui/eta.rs:98 :42
5151 |
5252LL | let e = Some(&mut vec![1, 2, 3]).map(|v| v.clear());
5353 | ^^^^^^^^^^^^^ help: replace the closure with the method itself: `std::vec::Vec::clear`
5454
5555error: redundant closure
56- --> tests/ui/eta.rs:101 :29
56+ --> tests/ui/eta.rs:102 :29
5757 |
5858LL | let e = Some("str").map(|s| s.to_string());
5959 | ^^^^^^^^^^^^^^^^^ help: replace the closure with the method itself: `std::string::ToString::to_string`
6060
6161error: redundant closure
62- --> tests/ui/eta.rs:102 :27
62+ --> tests/ui/eta.rs:103 :27
6363 |
6464LL | let e = Some('a').map(|s| s.to_uppercase());
6565 | ^^^^^^^^^^^^^^^^^^^^ help: replace the closure with the method itself: `char::to_uppercase`
6666
6767error: redundant closure
68- --> tests/ui/eta.rs:104 :65
68+ --> tests/ui/eta.rs:105 :65
6969 |
7070LL | let e: std::vec::Vec<char> = vec!['a', 'b', 'c'].iter().map(|c| c.to_ascii_uppercase()).collect();
7171 | ^^^^^^^^^^^^^^^^^^^^^^^^^^ help: replace the closure with the method itself: `char::to_ascii_uppercase`
7272
7373error: redundant closure
74- --> tests/ui/eta.rs:167 :22
74+ --> tests/ui/eta.rs:168 :22
7575 |
7676LL | requires_fn_once(|| x());
7777 | ^^^^^^ help: replace the closure with the function itself: `x`
7878
7979error: redundant closure
80- --> tests/ui/eta.rs:174 :27
80+ --> tests/ui/eta.rs:175 :27
8181 |
8282LL | let a = Some(1u8).map(|a| foo_ptr(a));
8383 | ^^^^^^^^^^^^^^ help: replace the closure with the function itself: `foo_ptr`
8484
8585error: redundant closure
86- --> tests/ui/eta.rs:179 :27
86+ --> tests/ui/eta.rs:180 :27
8787 |
8888LL | let a = Some(1u8).map(|a| closure(a));
8989 | ^^^^^^^^^^^^^^ help: replace the closure with the function itself: `closure`
9090
9191error: redundant closure
92- --> tests/ui/eta.rs:211 :28
92+ --> tests/ui/eta.rs:212 :28
9393 |
9494LL | x.into_iter().for_each(|x| add_to_res(x));
9595 | ^^^^^^^^^^^^^^^^^ help: replace the closure with the function itself: `&mut add_to_res`
9696
9797error: redundant closure
98- --> tests/ui/eta.rs:212 :28
98+ --> tests/ui/eta.rs:213 :28
9999 |
100100LL | y.into_iter().for_each(|x| add_to_res(x));
101101 | ^^^^^^^^^^^^^^^^^ help: replace the closure with the function itself: `&mut add_to_res`
102102
103103error: redundant closure
104- --> tests/ui/eta.rs:213 :28
104+ --> tests/ui/eta.rs:214 :28
105105 |
106106LL | z.into_iter().for_each(|x| add_to_res(x));
107107 | ^^^^^^^^^^^^^^^^^ help: replace the closure with the function itself: `add_to_res`
108108
109109error: redundant closure
110- --> tests/ui/eta.rs:220 :21
110+ --> tests/ui/eta.rs:221 :21
111111 |
112112LL | Some(1).map(|n| closure(n));
113113 | ^^^^^^^^^^^^^^ help: replace the closure with the function itself: `&mut closure`
114114
115115error: redundant closure
116- --> tests/ui/eta.rs:224 :21
116+ --> tests/ui/eta.rs:225 :21
117117 |
118118LL | Some(1).map(|n| in_loop(n));
119119 | ^^^^^^^^^^^^^^ help: replace the closure with the function itself: `in_loop`
120120
121121error: redundant closure
122- --> tests/ui/eta.rs:317 :18
122+ --> tests/ui/eta.rs:318 :18
123123 |
124124LL | takes_fn_mut(|| f());
125125 | ^^^^^^ help: replace the closure with the function itself: `&mut f`
126126
127127error: redundant closure
128- --> tests/ui/eta.rs:320 :19
128+ --> tests/ui/eta.rs:321 :19
129129 |
130130LL | takes_fn_once(|| f());
131131 | ^^^^^^ help: replace the closure with the function itself: `&mut f`
132132
133133error: redundant closure
134- --> tests/ui/eta.rs:324 :26
134+ --> tests/ui/eta.rs:325 :26
135135 |
136136LL | move || takes_fn_mut(|| f_used_once())
137137 | ^^^^^^^^^^^^^^^^ help: replace the closure with the function itself: `&mut f_used_once`
138138
139139error: redundant closure
140- --> tests/ui/eta.rs:336 :19
140+ --> tests/ui/eta.rs:337 :19
141141 |
142142LL | array_opt.map(|a| a.as_slice());
143143 | ^^^^^^^^^^^^^^^^ help: replace the closure with the method itself: `<[u8; 3]>::as_slice`
144144
145145error: redundant closure
146- --> tests/ui/eta.rs:339 :19
146+ --> tests/ui/eta.rs:340 :19
147147 |
148148LL | slice_opt.map(|s| s.len());
149149 | ^^^^^^^^^^^ help: replace the closure with the method itself: `<[u8]>::len`
150150
151151error: redundant closure
152- --> tests/ui/eta.rs:342 :17
152+ --> tests/ui/eta.rs:343 :17
153153 |
154154LL | ptr_opt.map(|p| p.is_null());
155155 | ^^^^^^^^^^^^^^^ help: replace the closure with the method itself: `<*const usize>::is_null`
156156
157157error: redundant closure
158- --> tests/ui/eta.rs:346 :17
158+ --> tests/ui/eta.rs:347 :17
159159 |
160160LL | dyn_opt.map(|d| d.method_on_dyn());
161161 | ^^^^^^^^^^^^^^^^^^^^^ help: replace the closure with the method itself: `<dyn TestTrait>::method_on_dyn`
162162
163163error: redundant closure
164- --> tests/ui/eta.rs:406 :19
164+ --> tests/ui/eta.rs:407 :19
165165 |
166166LL | let _ = f(&0, |x, y| f2(x, y));
167167 | ^^^^^^^^^^^^^^^ help: replace the closure with the function itself: `f2`
168168
169169error: redundant closure
170- --> tests/ui/eta.rs:434 :22
170+ --> tests/ui/eta.rs:435 :22
171171 |
172172LL | test.map(|t| t.method())
173173 | ^^^^^^^^^^^^^^ help: replace the closure with the method itself: `Test::method`
174174
175175error: redundant closure
176- --> tests/ui/eta.rs:438 :22
176+ --> tests/ui/eta.rs:439 :22
177177 |
178178LL | test.map(|t| t.method())
179179 | ^^^^^^^^^^^^^^ help: replace the closure with the method itself: `super::Outer::method`
180180
181181error: redundant closure
182- --> tests/ui/eta.rs:451 :18
182+ --> tests/ui/eta.rs:452 :18
183183 |
184184LL | test.map(|t| t.method())
185185 | ^^^^^^^^^^^^^^ help: replace the closure with the method itself: `test_mod::Test::method`
186186
187187error: redundant closure
188- --> tests/ui/eta.rs:458 :30
188+ --> tests/ui/eta.rs:459 :30
189189 |
190190LL | test.map(|t| t.method())
191191 | ^^^^^^^^^^^^^^ help: replace the closure with the method itself: `crate::issue_10854::d::Test::method`
192192
193193error: redundant closure
194- --> tests/ui/eta.rs:477 :38
194+ --> tests/ui/eta.rs:478 :38
195195 |
196196LL | let x = Box::new(|| None.map(|x| f(x)));
197197 | ^^^^^^^^ help: replace the closure with the function itself: `&f`
198198
199199error: redundant closure
200- --> tests/ui/eta.rs:481 :38
200+ --> tests/ui/eta.rs:482 :38
201201 |
202202LL | let x = Box::new(|| None.map(|x| f(x)));
203203 | ^^^^^^^^ help: replace the closure with the function itself: `f`
204204
205- error: aborting due to 33 previous errors
205+ error: redundant closure
206+ --> tests/ui/eta.rs:495:46
207+ |
208+ LL | let _field = bind.as_deref().or_else(|| get_default()).unwrap();
209+ | ^^^^^^^^^^^^^^^^ help: replace the closure with the function itself: `get_default`
210+
211+ error: redundant closure
212+ --> tests/ui/eta.rs:497:46
213+ |
214+ LL | let _field = bind.as_deref().or_else(|| get_default()).unwrap();
215+ | ^^^^^^^^^^^^^^^^ help: replace the closure with the function itself: `get_default`
216+
217+ error: redundant closure
218+ --> tests/ui/eta.rs:499:35
219+ |
220+ LL | let _field = bind.or_else(|| get_default()).unwrap();
221+ | ^^^^^^^^^^^^^^^^ help: replace the closure with the function itself: `get_default`
222+
223+ error: aborting due to 36 previous errors
206224
0 commit comments