1
1
error: redundant closure
2
- --> $DIR/eta.rs:28 :27
2
+ --> $DIR/eta.rs:29 :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
- --> $DIR/eta.rs:32 :40
11
+ --> $DIR/eta.rs:33 :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
- --> $DIR/eta.rs:33 :35
17
+ --> $DIR/eta.rs:34 :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
- --> $DIR/eta.rs:34 :26
23
+ --> $DIR/eta.rs:35 :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
- --> $DIR/eta.rs:41 :27
29
+ --> $DIR/eta.rs:42 :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
- --> $DIR/eta.rs:93 :51
35
+ --> $DIR/eta.rs:94 :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,127 +41,127 @@ 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
- --> $DIR/eta.rs:94 :51
44
+ --> $DIR/eta.rs:95 :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
- --> $DIR/eta.rs:96 :42
50
+ --> $DIR/eta.rs:97 :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
- --> $DIR/eta.rs:100 :29
56
+ --> $DIR/eta.rs:101 :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
- --> $DIR/eta.rs:101 :27
62
+ --> $DIR/eta.rs:102 :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
- --> $DIR/eta.rs:103 :65
68
+ --> $DIR/eta.rs:104 :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
- --> $DIR/eta.rs:166 :22
74
+ --> $DIR/eta.rs:167 :22
75
75
|
76
76
LL | requires_fn_once(|| x());
77
77
| ^^^^^^ help: replace the closure with the function itself: `x`
78
78
79
79
error: redundant closure
80
- --> $DIR/eta.rs:173 :27
80
+ --> $DIR/eta.rs:174 :27
81
81
|
82
82
LL | let a = Some(1u8).map(|a| foo_ptr(a));
83
83
| ^^^^^^^^^^^^^^ help: replace the closure with the function itself: `foo_ptr`
84
84
85
85
error: redundant closure
86
- --> $DIR/eta.rs:178 :27
86
+ --> $DIR/eta.rs:179 :27
87
87
|
88
88
LL | let a = Some(1u8).map(|a| closure(a));
89
89
| ^^^^^^^^^^^^^^ help: replace the closure with the function itself: `closure`
90
90
91
91
error: redundant closure
92
- --> $DIR/eta.rs:210 :28
92
+ --> $DIR/eta.rs:211 :28
93
93
|
94
94
LL | x.into_iter().for_each(|x| add_to_res(x));
95
95
| ^^^^^^^^^^^^^^^^^ help: replace the closure with the function itself: `&mut add_to_res`
96
96
97
97
error: redundant closure
98
- --> $DIR/eta.rs:211 :28
98
+ --> $DIR/eta.rs:212 :28
99
99
|
100
100
LL | y.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
- --> $DIR/eta.rs:212 :28
104
+ --> $DIR/eta.rs:213 :28
105
105
|
106
106
LL | z.into_iter().for_each(|x| add_to_res(x));
107
107
| ^^^^^^^^^^^^^^^^^ help: replace the closure with the function itself: `add_to_res`
108
108
109
109
error: redundant closure
110
- --> $DIR/eta.rs:219 :21
110
+ --> $DIR/eta.rs:220 :21
111
111
|
112
112
LL | Some(1).map(|n| closure(n));
113
113
| ^^^^^^^^^^^^^^ help: replace the closure with the function itself: `&mut closure`
114
114
115
115
error: redundant closure
116
- --> $DIR/eta.rs:223 :21
116
+ --> $DIR/eta.rs:224 :21
117
117
|
118
118
LL | Some(1).map(|n| in_loop(n));
119
119
| ^^^^^^^^^^^^^^ help: replace the closure with the function itself: `in_loop`
120
120
121
121
error: redundant closure
122
- --> $DIR/eta.rs:316 :18
122
+ --> $DIR/eta.rs:317 :18
123
123
|
124
124
LL | takes_fn_mut(|| f());
125
125
| ^^^^^^ help: replace the closure with the function itself: `&mut f`
126
126
127
127
error: redundant closure
128
- --> $DIR/eta.rs:319 :19
128
+ --> $DIR/eta.rs:320 :19
129
129
|
130
130
LL | takes_fn_once(|| f());
131
131
| ^^^^^^ help: replace the closure with the function itself: `&mut f`
132
132
133
133
error: redundant closure
134
- --> $DIR/eta.rs:323 :26
134
+ --> $DIR/eta.rs:324 :26
135
135
|
136
136
LL | move || takes_fn_mut(|| f_used_once())
137
137
| ^^^^^^^^^^^^^^^^ help: replace the closure with the function itself: `&mut f_used_once`
138
138
139
139
error: redundant closure
140
- --> $DIR/eta.rs:335 :19
140
+ --> $DIR/eta.rs:336 :19
141
141
|
142
142
LL | array_opt.map(|a| a.as_slice());
143
143
| ^^^^^^^^^^^^^^^^ help: replace the closure with the method itself: `<[u8; 3]>::as_slice`
144
144
145
145
error: redundant closure
146
- --> $DIR/eta.rs:338 :19
146
+ --> $DIR/eta.rs:339 :19
147
147
|
148
148
LL | slice_opt.map(|s| s.len());
149
149
| ^^^^^^^^^^^ help: replace the closure with the method itself: `<[u8]>::len`
150
150
151
151
error: redundant closure
152
- --> $DIR/eta.rs:341 :17
152
+ --> $DIR/eta.rs:342 :17
153
153
|
154
154
LL | ptr_opt.map(|p| p.is_null());
155
155
| ^^^^^^^^^^^^^^^ help: replace the closure with the method itself: `<*const usize>::is_null`
156
156
157
157
error: redundant closure
158
- --> $DIR/eta.rs:345 :17
158
+ --> $DIR/eta.rs:346 :17
159
159
|
160
160
LL | dyn_opt.map(|d| d.method_on_dyn());
161
161
| ^^^^^^^^^^^^^^^^^^^^^ help: replace the closure with the method itself: `<dyn TestTrait>::method_on_dyn`
162
162
163
163
error: redundant closure
164
- --> $DIR/eta.rs:388 :19
164
+ --> $DIR/eta.rs:389 :19
165
165
|
166
166
LL | let _ = f(&0, |x, y| f2(x, y));
167
167
| ^^^^^^^^^^^^^^^ help: replace the closure with the function itself: `f2`
0 commit comments