1
1
error: redundant closure
2
- --> tests/ui/eta.rs:31 :27
2
+ --> tests/ui/eta.rs:34 :27
3
3
|
4
4
LL | let a = Some(1u8).map(|a| foo(a));
5
5
| ^^^^^^^^^^ help: replace the closure with the function itself: `foo`
@@ -8,31 +8,31 @@ LL | let a = Some(1u8).map(|a| foo(a));
8
8
= help: to override `-D warnings` add `#[allow(clippy::redundant_closure)]`
9
9
10
10
error: redundant closure
11
- --> tests/ui/eta.rs:36 :40
11
+ --> tests/ui/eta.rs:39 :40
12
12
|
13
13
LL | let _: Option<Vec<u8>> = true.then(|| vec![]); // special case vec!
14
14
| ^^^^^^^^^ help: replace the closure with `Vec::new`: `std::vec::Vec::new`
15
15
16
16
error: redundant closure
17
- --> tests/ui/eta.rs:39 :35
17
+ --> tests/ui/eta.rs:42 :35
18
18
|
19
19
LL | let d = Some(1u8).map(|a| foo((|b| foo2(b))(a))); //is adjusted?
20
20
| ^^^^^^^^^^^^^ help: replace the closure with the function itself: `foo2`
21
21
22
22
error: redundant closure
23
- --> tests/ui/eta.rs:42 :26
23
+ --> tests/ui/eta.rs:45 :26
24
24
|
25
25
LL | all(&[1, 2, 3], &&2, |x, y| below(x, y)); //is adjusted
26
26
| ^^^^^^^^^^^^^^^^^^ help: replace the closure with the function itself: `below`
27
27
28
28
error: redundant closure
29
- --> tests/ui/eta.rs:51 :27
29
+ --> tests/ui/eta.rs:54 :27
30
30
|
31
31
LL | let e = Some(1u8).map(|a| generic(a));
32
32
| ^^^^^^^^^^^^^^ help: replace the closure with the function itself: `generic`
33
33
34
34
error: redundant closure
35
- --> tests/ui/eta.rs:104 :51
35
+ --> tests/ui/eta.rs:107 :51
36
36
|
37
37
LL | let e = Some(TestStruct { some_ref: &i }).map(|a| a.foo());
38
38
| ^^^^^^^^^^^ help: replace the closure with the method itself: `TestStruct::foo`
@@ -41,178 +41,202 @@ LL | let e = Some(TestStruct { some_ref: &i }).map(|a| a.foo());
41
41
= help: to override `-D warnings` add `#[allow(clippy::redundant_closure_for_method_calls)]`
42
42
43
43
error: redundant closure
44
- --> tests/ui/eta.rs:106 :51
44
+ --> tests/ui/eta.rs:109 :51
45
45
|
46
46
LL | let e = Some(TestStruct { some_ref: &i }).map(|a| a.trait_foo());
47
47
| ^^^^^^^^^^^^^^^^^ help: replace the closure with the method itself: `TestTrait::trait_foo`
48
48
49
49
error: redundant closure
50
- --> tests/ui/eta.rs:109 :42
50
+ --> tests/ui/eta.rs:112 :42
51
51
|
52
52
LL | let e = Some(&mut vec![1, 2, 3]).map(|v| v.clear());
53
53
| ^^^^^^^^^^^^^ help: replace the closure with the method itself: `std::vec::Vec::clear`
54
54
55
55
error: redundant closure
56
- --> tests/ui/eta.rs:114 :29
56
+ --> tests/ui/eta.rs:117 :29
57
57
|
58
58
LL | let e = Some("str").map(|s| s.to_string());
59
59
| ^^^^^^^^^^^^^^^^^ help: replace the closure with the method itself: `std::string::ToString::to_string`
60
60
61
61
error: redundant closure
62
- --> tests/ui/eta.rs:116 :27
62
+ --> tests/ui/eta.rs:119 :27
63
63
|
64
64
LL | let e = Some('a').map(|s| s.to_uppercase());
65
65
| ^^^^^^^^^^^^^^^^^^^^ help: replace the closure with the method itself: `char::to_uppercase`
66
66
67
67
error: redundant closure
68
- --> tests/ui/eta.rs:119 :65
68
+ --> tests/ui/eta.rs:122 :65
69
69
|
70
70
LL | let e: std::vec::Vec<char> = vec!['a', 'b', 'c'].iter().map(|c| c.to_ascii_uppercase()).collect();
71
71
| ^^^^^^^^^^^^^^^^^^^^^^^^^^ help: replace the closure with the method itself: `char::to_ascii_uppercase`
72
72
73
73
error: redundant closure
74
- --> tests/ui/eta.rs:136 :23
74
+ --> tests/ui/eta.rs:139 :23
75
75
|
76
76
LL | let _ = x.map(|x| x.parse::<i16>());
77
77
| ^^^^^^^^^^^^^^^^^^^^ help: replace the closure with the method itself: `str::parse::<i16>`
78
78
79
79
error: redundant closure
80
- --> tests/ui/eta.rs:189 :22
80
+ --> tests/ui/eta.rs:192 :22
81
81
|
82
82
LL | requires_fn_once(|| x());
83
83
| ^^^^^^ help: replace the closure with the function itself: `x`
84
84
85
85
error: redundant closure
86
- --> tests/ui/eta.rs:197 :27
86
+ --> tests/ui/eta.rs:200 :27
87
87
|
88
88
LL | let a = Some(1u8).map(|a| foo_ptr(a));
89
89
| ^^^^^^^^^^^^^^ help: replace the closure with the function itself: `foo_ptr`
90
90
91
91
error: redundant closure
92
- --> tests/ui/eta.rs:203 :27
92
+ --> tests/ui/eta.rs:206 :27
93
93
|
94
94
LL | let a = Some(1u8).map(|a| closure(a));
95
95
| ^^^^^^^^^^^^^^ help: replace the closure with the function itself: `closure`
96
96
97
97
error: redundant closure
98
- --> tests/ui/eta.rs:236 :28
98
+ --> tests/ui/eta.rs:239 :28
99
99
|
100
100
LL | x.into_iter().for_each(|x| add_to_res(x));
101
101
| ^^^^^^^^^^^^^^^^^ help: replace the closure with the function itself: `&mut add_to_res`
102
102
103
103
error: redundant closure
104
- --> tests/ui/eta.rs:238 :28
104
+ --> tests/ui/eta.rs:241 :28
105
105
|
106
106
LL | y.into_iter().for_each(|x| add_to_res(x));
107
107
| ^^^^^^^^^^^^^^^^^ help: replace the closure with the function itself: `&mut add_to_res`
108
108
109
109
error: redundant closure
110
- --> tests/ui/eta.rs:240 :28
110
+ --> tests/ui/eta.rs:243 :28
111
111
|
112
112
LL | z.into_iter().for_each(|x| add_to_res(x));
113
113
| ^^^^^^^^^^^^^^^^^ help: replace the closure with the function itself: `add_to_res`
114
114
115
115
error: redundant closure
116
- --> tests/ui/eta.rs:248 :21
116
+ --> tests/ui/eta.rs:251 :21
117
117
|
118
118
LL | Some(1).map(|n| closure(n));
119
119
| ^^^^^^^^^^^^^^ help: replace the closure with the function itself: `&mut closure`
120
120
121
121
error: redundant closure
122
- --> tests/ui/eta.rs:253 :21
122
+ --> tests/ui/eta.rs:256 :21
123
123
|
124
124
LL | Some(1).map(|n| in_loop(n));
125
125
| ^^^^^^^^^^^^^^ help: replace the closure with the function itself: `in_loop`
126
126
127
127
error: redundant closure
128
- --> tests/ui/eta.rs:347 :18
128
+ --> tests/ui/eta.rs:350 :18
129
129
|
130
130
LL | takes_fn_mut(|| f());
131
131
| ^^^^^^ help: replace the closure with the function itself: `&mut f`
132
132
133
133
error: redundant closure
134
- --> tests/ui/eta.rs:351 :19
134
+ --> tests/ui/eta.rs:354 :19
135
135
|
136
136
LL | takes_fn_once(|| f());
137
137
| ^^^^^^ help: replace the closure with the function itself: `&mut f`
138
138
139
139
error: redundant closure
140
- --> tests/ui/eta.rs:356 :26
140
+ --> tests/ui/eta.rs:359 :26
141
141
|
142
142
LL | move || takes_fn_mut(|| f_used_once())
143
143
| ^^^^^^^^^^^^^^^^ help: replace the closure with the function itself: `&mut f_used_once`
144
144
145
145
error: redundant closure
146
- --> tests/ui/eta.rs:369 :19
146
+ --> tests/ui/eta.rs:372 :19
147
147
|
148
148
LL | array_opt.map(|a| a.as_slice());
149
149
| ^^^^^^^^^^^^^^^^ help: replace the closure with the method itself: `<[u8; 3]>::as_slice`
150
150
151
151
error: redundant closure
152
- --> tests/ui/eta.rs:373 :19
152
+ --> tests/ui/eta.rs:376 :19
153
153
|
154
154
LL | slice_opt.map(|s| s.len());
155
155
| ^^^^^^^^^^^ help: replace the closure with the method itself: `<[u8]>::len`
156
156
157
157
error: redundant closure
158
- --> tests/ui/eta.rs:377 :17
158
+ --> tests/ui/eta.rs:380 :17
159
159
|
160
160
LL | ptr_opt.map(|p| p.is_null());
161
161
| ^^^^^^^^^^^^^^^ help: replace the closure with the method itself: `<*const usize>::is_null`
162
162
163
163
error: redundant closure
164
- --> tests/ui/eta.rs:382 :17
164
+ --> tests/ui/eta.rs:385 :17
165
165
|
166
166
LL | dyn_opt.map(|d| d.method_on_dyn());
167
167
| ^^^^^^^^^^^^^^^^^^^^^ help: replace the closure with the method itself: `<dyn TestTrait>::method_on_dyn`
168
168
169
169
error: redundant closure
170
- --> tests/ui/eta.rs:443 :19
170
+ --> tests/ui/eta.rs:446 :19
171
171
|
172
172
LL | let _ = f(&0, |x, y| f2(x, y));
173
173
| ^^^^^^^^^^^^^^^ help: replace the closure with the function itself: `f2`
174
174
175
175
error: redundant closure
176
- --> tests/ui/eta.rs:472 :22
176
+ --> tests/ui/eta.rs:475 :22
177
177
|
178
178
LL | test.map(|t| t.method())
179
179
| ^^^^^^^^^^^^^^ help: replace the closure with the method itself: `Test::method`
180
180
181
181
error: redundant closure
182
- --> tests/ui/eta.rs:477 :22
182
+ --> tests/ui/eta.rs:480 :22
183
183
|
184
184
LL | test.map(|t| t.method())
185
185
| ^^^^^^^^^^^^^^ help: replace the closure with the method itself: `super::Outer::method`
186
186
187
187
error: redundant closure
188
- --> tests/ui/eta.rs:491 :18
188
+ --> tests/ui/eta.rs:494 :18
189
189
|
190
190
LL | test.map(|t| t.method())
191
191
| ^^^^^^^^^^^^^^ help: replace the closure with the method itself: `test_mod::Test::method`
192
192
193
193
error: redundant closure
194
- --> tests/ui/eta.rs:499 :30
194
+ --> tests/ui/eta.rs:502 :30
195
195
|
196
196
LL | test.map(|t| t.method())
197
197
| ^^^^^^^^^^^^^^ help: replace the closure with the method itself: `crate::issue_10854::d::Test::method`
198
198
199
199
error: redundant closure
200
- --> tests/ui/eta.rs:519 :38
200
+ --> tests/ui/eta.rs:522 :38
201
201
|
202
202
LL | let x = Box::new(|| None.map(|x| f(x)));
203
203
| ^^^^^^^^ help: replace the closure with the function itself: `&f`
204
204
205
205
error: redundant closure
206
- --> tests/ui/eta.rs:524 :38
206
+ --> tests/ui/eta.rs:527 :38
207
207
|
208
208
LL | let x = Box::new(|| None.map(|x| f(x)));
209
209
| ^^^^^^^^ help: replace the closure with the function itself: `f`
210
210
211
211
error: redundant closure
212
- --> tests/ui/eta.rs:542 :35
212
+ --> tests/ui/eta.rs:545 :35
213
213
|
214
214
LL | let _field = bind.or_else(|| get_default()).unwrap();
215
215
| ^^^^^^^^^^^^^^^^ help: replace the closure with the function itself: `get_default`
216
216
217
- error: aborting due to 35 previous errors
217
+ error: redundant closure
218
+ --> tests/ui/eta.rs:588:14
219
+ |
220
+ LL | .map(|n| MyError::A(n))
221
+ | ^^^^^^^^^^^^^^^^^ help: replace the closure with the tuple variant itself: `MyError::A`
222
+
223
+ error: redundant closure
224
+ --> tests/ui/eta.rs:585:14
225
+ |
226
+ LL | .map(|n| S(n))
227
+ | ^^^^^^^^ help: replace the closure with the tuple struct itself: `S`
228
+
229
+ error: redundant closure
230
+ --> tests/ui/eta.rs:582:14
231
+ |
232
+ LL | .map(|n| g(n))
233
+ | ^^^^^^^^ help: replace the closure with the function itself: `g`
234
+
235
+ error: redundant closure
236
+ --> tests/ui/eta.rs:579:14
237
+ |
238
+ LL | .map(|n| f(n))
239
+ | ^^^^^^^^ help: replace the closure with the function itself: `f`
240
+
241
+ error: aborting due to 39 previous errors
218
242
0 commit comments