11error: redundant closure
2- --> $DIR/eta.rs:28 :27
2+ --> $DIR/eta.rs:29 :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- --> $DIR/eta.rs:32 :40
11+ --> $DIR/eta.rs:33 :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- --> $DIR/eta.rs:33 :35
17+ --> $DIR/eta.rs:34 :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- --> $DIR/eta.rs:34 :26
23+ --> $DIR/eta.rs:35 :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- --> $DIR/eta.rs:41 :27
29+ --> $DIR/eta.rs:42 :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- --> $DIR/eta.rs:93 :51
35+ --> $DIR/eta.rs:94 :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,127 +41,127 @@ 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- --> $DIR/eta.rs:94 :51
44+ --> $DIR/eta.rs:95 :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- --> $DIR/eta.rs:96 :42
50+ --> $DIR/eta.rs:97 :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- --> $DIR/eta.rs:100 :29
56+ --> $DIR/eta.rs:101 :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- --> $DIR/eta.rs:101 :27
62+ --> $DIR/eta.rs:102 :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- --> $DIR/eta.rs:103 :65
68+ --> $DIR/eta.rs:104 :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- --> $DIR/eta.rs:166 :22
74+ --> $DIR/eta.rs:167 :22
7575 |
7676LL | requires_fn_once(|| x());
7777 | ^^^^^^ help: replace the closure with the function itself: `x`
7878
7979error: redundant closure
80- --> $DIR/eta.rs:173 :27
80+ --> $DIR/eta.rs:174 :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- --> $DIR/eta.rs:178 :27
86+ --> $DIR/eta.rs:179 :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- --> $DIR/eta.rs:210 :28
92+ --> $DIR/eta.rs:211 :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- --> $DIR/eta.rs:211 :28
98+ --> $DIR/eta.rs:212 :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- --> $DIR/eta.rs:212 :28
104+ --> $DIR/eta.rs:213 :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- --> $DIR/eta.rs:219 :21
110+ --> $DIR/eta.rs:220 :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- --> $DIR/eta.rs:223 :21
116+ --> $DIR/eta.rs:224 :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- --> $DIR/eta.rs:316 :18
122+ --> $DIR/eta.rs:317 :18
123123 |
124124LL | takes_fn_mut(|| f());
125125 | ^^^^^^ help: replace the closure with the function itself: `&mut f`
126126
127127error: redundant closure
128- --> $DIR/eta.rs:319 :19
128+ --> $DIR/eta.rs:320 :19
129129 |
130130LL | takes_fn_once(|| f());
131131 | ^^^^^^ help: replace the closure with the function itself: `&mut f`
132132
133133error: redundant closure
134- --> $DIR/eta.rs:323 :26
134+ --> $DIR/eta.rs:324 :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- --> $DIR/eta.rs:335 :19
140+ --> $DIR/eta.rs:336 :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- --> $DIR/eta.rs:338 :19
146+ --> $DIR/eta.rs:339 :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- --> $DIR/eta.rs:341 :17
152+ --> $DIR/eta.rs:342 :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- --> $DIR/eta.rs:345 :17
158+ --> $DIR/eta.rs:346 :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- --> $DIR/eta.rs:388 :19
164+ --> $DIR/eta.rs:389 :19
165165 |
166166LL | let _ = f(&0, |x, y| f2(x, y));
167167 | ^^^^^^^^^^^^^^^ help: replace the closure with the function itself: `f2`
0 commit comments