11error: this `.fold` can be written more succinctly using another method
2- --> tests/ui/unnecessary_fold.rs:12 :20
2+ --> tests/ui/unnecessary_fold.rs:11 :20
33 |
44LL | let _ = (0..3).fold(false, |acc, x| acc || x > 2);
55 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `any(|x| x > 2)`
@@ -9,7 +9,7 @@ LL | let _ = (0..3).fold(false, |acc, x| acc || x > 2);
99 = help: to override `-D warnings` add `#[allow(clippy::unnecessary_fold)]`
1010
1111error: redundant closure
12- --> tests/ui/unnecessary_fold.rs:16 :32
12+ --> tests/ui/unnecessary_fold.rs:15 :32
1313 |
1414LL | let _ = (0..3).fold(false, |acc, x| is_any(acc, x));
1515 | ^^^^^^^^^^^^^^^^^^^^^^^ help: replace the closure with the function itself: `is_any`
@@ -18,245 +18,245 @@ LL | let _ = (0..3).fold(false, |acc, x| is_any(acc, x));
1818 = help: to override `-D warnings` add `#[allow(clippy::redundant_closure)]`
1919
2020error: this `.fold` can be written more succinctly using another method
21- --> tests/ui/unnecessary_fold.rs:20 :20
21+ --> tests/ui/unnecessary_fold.rs:19 :20
2222 |
2323LL | let _ = (0..3).fold(true, |acc, x| acc && x > 2);
2424 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `all(|x| x > 2)`
2525 |
2626 = note: the `all` method is short circuiting and may change the program semantics if the iterator has side effects
2727
2828error: this `.fold` can be written more succinctly using another method
29- --> tests/ui/unnecessary_fold.rs:24 :25
29+ --> tests/ui/unnecessary_fold.rs:23 :25
3030 |
3131LL | let _: i32 = (0..3).fold(0, |acc, x| acc + x);
3232 | ^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `sum()`
3333
3434error: this `.fold` can be written more succinctly using another method
35- --> tests/ui/unnecessary_fold.rs:26 :25
35+ --> tests/ui/unnecessary_fold.rs:25 :25
3636 |
3737LL | let _: i32 = (0..3).fold(0, Add::add);
3838 | ^^^^^^^^^^^^^^^^^ help: try: `sum()`
3939
4040error: this `.fold` can be written more succinctly using another method
41- --> tests/ui/unnecessary_fold.rs:28 :25
41+ --> tests/ui/unnecessary_fold.rs:27 :25
4242 |
4343LL | let _: i32 = (0..3).fold(0, i32::add);
4444 | ^^^^^^^^^^^^^^^^^ help: try: `sum()`
4545
4646error: this `.fold` can be written more succinctly using another method
47- --> tests/ui/unnecessary_fold.rs:32 :25
47+ --> tests/ui/unnecessary_fold.rs:31 :25
4848 |
4949LL | let _: i32 = (0..3).fold(1, |acc, x| acc * x);
5050 | ^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `product()`
5151
5252error: this `.fold` can be written more succinctly using another method
53- --> tests/ui/unnecessary_fold.rs:34 :25
53+ --> tests/ui/unnecessary_fold.rs:33 :25
5454 |
5555LL | let _: i32 = (0..3).fold(1, Mul::mul);
5656 | ^^^^^^^^^^^^^^^^^ help: try: `product()`
5757
5858error: this `.fold` can be written more succinctly using another method
59- --> tests/ui/unnecessary_fold.rs:36 :25
59+ --> tests/ui/unnecessary_fold.rs:35 :25
6060 |
6161LL | let _: i32 = (0..3).fold(1, i32::mul);
6262 | ^^^^^^^^^^^^^^^^^ help: try: `product()`
6363
6464error: this `.fold` can be written more succinctly using another method
65- --> tests/ui/unnecessary_fold.rs:42 :41
65+ --> tests/ui/unnecessary_fold.rs:41 :41
6666 |
6767LL | let _: bool = (0..3).map(|x| 2 * x).fold(false, |acc, x| acc || x > 2);
6868 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `any(|x| x > 2)`
6969 |
7070 = note: the `any` method is short circuiting and may change the program semantics if the iterator has side effects
7171
7272error: this `.fold` can be written more succinctly using another method
73- --> tests/ui/unnecessary_fold.rs:100 :10
73+ --> tests/ui/unnecessary_fold.rs:99 :10
7474 |
7575LL | .fold(false, |acc, x| acc || x > 2);
7676 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `any(|x| x > 2)`
7777 |
7878 = note: the `any` method is short circuiting and may change the program semantics if the iterator has side effects
7979
8080error: this `.fold` can be written more succinctly using another method
81- --> tests/ui/unnecessary_fold.rs:113 :33
81+ --> tests/ui/unnecessary_fold.rs:112 :33
8282 |
8383LL | assert_eq!(map.values().fold(0, |x, y| x + y), 0);
8484 | ^^^^^^^^^^^^^^^^^^^^^ help: try: `sum::<i32>()`
8585
8686error: this `.fold` can be written more succinctly using another method
87- --> tests/ui/unnecessary_fold.rs:117 :30
87+ --> tests/ui/unnecessary_fold.rs:116 :30
8888 |
8989LL | let _ = map.values().fold(0, |x, y| x + y);
9090 | ^^^^^^^^^^^^^^^^^^^^^ help: try: `sum::<i32>()`
9191
9292error: this `.fold` can be written more succinctly using another method
93- --> tests/ui/unnecessary_fold.rs:119 :30
93+ --> tests/ui/unnecessary_fold.rs:118 :30
9494 |
9595LL | let _ = map.values().fold(0, Add::add);
9696 | ^^^^^^^^^^^^^^^^^ help: try: `sum::<i32>()`
9797
9898error: this `.fold` can be written more succinctly using another method
99- --> tests/ui/unnecessary_fold.rs:121 :30
99+ --> tests/ui/unnecessary_fold.rs:120 :30
100100 |
101101LL | let _ = map.values().fold(1, |x, y| x * y);
102102 | ^^^^^^^^^^^^^^^^^^^^^ help: try: `product::<i32>()`
103103
104104error: this `.fold` can be written more succinctly using another method
105- --> tests/ui/unnecessary_fold.rs:123 :30
105+ --> tests/ui/unnecessary_fold.rs:122 :30
106106 |
107107LL | let _ = map.values().fold(1, Mul::mul);
108108 | ^^^^^^^^^^^^^^^^^ help: try: `product::<i32>()`
109109
110110error: this `.fold` can be written more succinctly using another method
111- --> tests/ui/unnecessary_fold.rs:125 :35
111+ --> tests/ui/unnecessary_fold.rs:124 :35
112112 |
113113LL | let _: i32 = map.values().fold(0, |x, y| x + y);
114114 | ^^^^^^^^^^^^^^^^^^^^^ help: try: `sum()`
115115
116116error: this `.fold` can be written more succinctly using another method
117- --> tests/ui/unnecessary_fold.rs:127 :35
117+ --> tests/ui/unnecessary_fold.rs:126 :35
118118 |
119119LL | let _: i32 = map.values().fold(0, Add::add);
120120 | ^^^^^^^^^^^^^^^^^ help: try: `sum()`
121121
122122error: this `.fold` can be written more succinctly using another method
123- --> tests/ui/unnecessary_fold.rs:129 :35
123+ --> tests/ui/unnecessary_fold.rs:128 :35
124124 |
125125LL | let _: i32 = map.values().fold(1, |x, y| x * y);
126126 | ^^^^^^^^^^^^^^^^^^^^^ help: try: `product()`
127127
128128error: this `.fold` can be written more succinctly using another method
129- --> tests/ui/unnecessary_fold.rs:131 :35
129+ --> tests/ui/unnecessary_fold.rs:130 :35
130130 |
131131LL | let _: i32 = map.values().fold(1, Mul::mul);
132132 | ^^^^^^^^^^^^^^^^^ help: try: `product()`
133133
134134error: this `.fold` can be written more succinctly using another method
135- --> tests/ui/unnecessary_fold.rs:133 :31
135+ --> tests/ui/unnecessary_fold.rs:132 :31
136136 |
137137LL | anything(map.values().fold(0, |x, y| x + y));
138138 | ^^^^^^^^^^^^^^^^^^^^^ help: try: `sum::<i32>()`
139139
140140error: this `.fold` can be written more succinctly using another method
141- --> tests/ui/unnecessary_fold.rs:135 :31
141+ --> tests/ui/unnecessary_fold.rs:134 :31
142142 |
143143LL | anything(map.values().fold(0, Add::add));
144144 | ^^^^^^^^^^^^^^^^^ help: try: `sum::<i32>()`
145145
146146error: this `.fold` can be written more succinctly using another method
147- --> tests/ui/unnecessary_fold.rs:137 :31
147+ --> tests/ui/unnecessary_fold.rs:136 :31
148148 |
149149LL | anything(map.values().fold(1, |x, y| x * y));
150150 | ^^^^^^^^^^^^^^^^^^^^^ help: try: `product::<i32>()`
151151
152152error: this `.fold` can be written more succinctly using another method
153- --> tests/ui/unnecessary_fold.rs:139 :31
153+ --> tests/ui/unnecessary_fold.rs:138 :31
154154 |
155155LL | anything(map.values().fold(1, Mul::mul));
156156 | ^^^^^^^^^^^^^^^^^ help: try: `product::<i32>()`
157157
158158error: this `.fold` can be written more succinctly using another method
159- --> tests/ui/unnecessary_fold.rs:141 :26
159+ --> tests/ui/unnecessary_fold.rs:140 :26
160160 |
161161LL | num(map.values().fold(0, |x, y| x + y));
162162 | ^^^^^^^^^^^^^^^^^^^^^ help: try: `sum()`
163163
164164error: this `.fold` can be written more succinctly using another method
165- --> tests/ui/unnecessary_fold.rs:143 :26
165+ --> tests/ui/unnecessary_fold.rs:142 :26
166166 |
167167LL | num(map.values().fold(0, Add::add));
168168 | ^^^^^^^^^^^^^^^^^ help: try: `sum()`
169169
170170error: this `.fold` can be written more succinctly using another method
171- --> tests/ui/unnecessary_fold.rs:145 :26
171+ --> tests/ui/unnecessary_fold.rs:144 :26
172172 |
173173LL | num(map.values().fold(1, |x, y| x * y));
174174 | ^^^^^^^^^^^^^^^^^^^^^ help: try: `product()`
175175
176176error: this `.fold` can be written more succinctly using another method
177- --> tests/ui/unnecessary_fold.rs:147 :26
177+ --> tests/ui/unnecessary_fold.rs:146 :26
178178 |
179179LL | num(map.values().fold(1, Mul::mul));
180180 | ^^^^^^^^^^^^^^^^^ help: try: `product()`
181181
182182error: this `.fold` can be written more succinctly using another method
183- --> tests/ui/unnecessary_fold.rs:154 :16
183+ --> tests/ui/unnecessary_fold.rs:153 :16
184184 |
185185LL | (0..3).fold(0, |acc, x| acc + x)
186186 | ^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `sum()`
187187
188188error: this `.fold` can be written more succinctly using another method
189- --> tests/ui/unnecessary_fold.rs:158 :16
189+ --> tests/ui/unnecessary_fold.rs:157 :16
190190 |
191191LL | (0..3).fold(1, |acc, x| acc * x)
192192 | ^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `product()`
193193
194194error: this `.fold` can be written more succinctly using another method
195- --> tests/ui/unnecessary_fold.rs:162 :16
195+ --> tests/ui/unnecessary_fold.rs:161 :16
196196 |
197197LL | (0..3).fold(0, |acc, x| acc + x)
198198 | ^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `sum::<i32>()`
199199
200200error: this `.fold` can be written more succinctly using another method
201- --> tests/ui/unnecessary_fold.rs:166 :16
201+ --> tests/ui/unnecessary_fold.rs:165 :16
202202 |
203203LL | (0..3).fold(1, |acc, x| acc * x)
204204 | ^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `product::<i32>()`
205205
206206error: this `.fold` can be written more succinctly using another method
207- --> tests/ui/unnecessary_fold.rs:172 :21
207+ --> tests/ui/unnecessary_fold.rs:171 :21
208208 |
209209LL | let _ = (2..=3).fold(1, |a, b| a * b);
210210 | ^^^^^^^^^^^^^^^^^^^^^ help: try: `product::<i32>()`
211211
212212error: this `.fold` can be written more succinctly using another method
213- --> tests/ui/unnecessary_fold.rs:174 :21
213+ --> tests/ui/unnecessary_fold.rs:173 :21
214214 |
215215LL | let _ = (1..=3).fold(0, |a, b| a + b);
216216 | ^^^^^^^^^^^^^^^^^^^^^ help: try: `sum::<i32>()`
217217
218218error: this `.fold` can be written more succinctly using another method
219- --> tests/ui/unnecessary_fold.rs:176 :21
219+ --> tests/ui/unnecessary_fold.rs:175 :21
220220 |
221221LL | let _ = (2..=3).fold(1, |b, a| a * b);
222222 | ^^^^^^^^^^^^^^^^^^^^^ help: try: `product::<i32>()`
223223
224224error: this `.fold` can be written more succinctly using another method
225- --> tests/ui/unnecessary_fold.rs:178 :21
225+ --> tests/ui/unnecessary_fold.rs:177 :21
226226 |
227227LL | let _ = (1..=3).fold(0, |b, a| a + b);
228228 | ^^^^^^^^^^^^^^^^^^^^^ help: try: `sum::<i32>()`
229229
230230error: this `.fold` can be written more succinctly using another method
231- --> tests/ui/unnecessary_fold.rs:181 :20
231+ --> tests/ui/unnecessary_fold.rs:180 :20
232232 |
233233LL | let _ = (0..3).fold(false, |acc, x| x > 2 || acc);
234234 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `any(|x| x > 2)`
235235 |
236236 = note: the `any` method is short circuiting and may change the program semantics if the iterator has side effects
237237
238238error: this `.fold` can be written more succinctly using another method
239- --> tests/ui/unnecessary_fold.rs:183 :20
239+ --> tests/ui/unnecessary_fold.rs:182 :20
240240 |
241241LL | let _ = (0..3).fold(true, |acc, x| x > 2 && acc);
242242 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `all(|x| x > 2)`
243243 |
244244 = note: the `all` method is short circuiting and may change the program semantics if the iterator has side effects
245245
246246error: this `.fold` can be written more succinctly using another method
247- --> tests/ui/unnecessary_fold.rs:185 :20
247+ --> tests/ui/unnecessary_fold.rs:184 :20
248248 |
249249LL | let _ = (0..3).fold(0, |acc, x| x + acc);
250250 | ^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `sum::<i32>()`
251251
252252error: this `.fold` can be written more succinctly using another method
253- --> tests/ui/unnecessary_fold.rs:187 :20
253+ --> tests/ui/unnecessary_fold.rs:186 :20
254254 |
255255LL | let _ = (0..3).fold(1, |acc, x| x * acc);
256256 | ^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `product::<i32>()`
257257
258258error: this `.fold` can be written more succinctly using another method
259- --> tests/ui/unnecessary_fold.rs:198 :20
259+ --> tests/ui/unnecessary_fold.rs:197 :20
260260 |
261261LL | let _ = (0..3).fold(false, |acc: bool, x| acc || test_expr!(x));
262262 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `any(|x| test_expr!(x))`
0 commit comments