mirror of
https://github.com/rust-lang/rust-clippy
synced 2024-11-27 15:11:30 +00:00
35 lines
1.3 KiB
Text
35 lines
1.3 KiB
Text
|
error: this `.fold` can be written more succinctly using another method
|
||
|
--> $DIR/unnecessary_fold.rs:4:19
|
||
|
|
|
||
|
4 | let _ = (0..3).fold(false, |acc, x| acc || x > 2);
|
||
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `.any(|x| x > 2)`
|
||
|
|
|
||
|
= note: `-D unnecessary-fold` implied by `-D warnings`
|
||
|
|
||
|
error: this `.fold` can be written more succinctly using another method
|
||
|
--> $DIR/unnecessary_fold.rs:6:19
|
||
|
|
|
||
|
6 | let _ = (0..3).fold(true, |acc, x| acc && x > 2);
|
||
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `.all(|x| x > 2)`
|
||
|
|
||
|
error: this `.fold` can be written more succinctly using another method
|
||
|
--> $DIR/unnecessary_fold.rs:8:19
|
||
|
|
|
||
|
8 | let _ = (0..3).fold(0, |acc, x| acc + x);
|
||
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `.sum()`
|
||
|
|
||
|
error: this `.fold` can be written more succinctly using another method
|
||
|
--> $DIR/unnecessary_fold.rs:10:19
|
||
|
|
|
||
|
10 | let _ = (0..3).fold(1, |acc, x| acc * x);
|
||
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `.product()`
|
||
|
|
||
|
error: this `.fold` can be written more succinctly using another method
|
||
|
--> $DIR/unnecessary_fold.rs:15:34
|
||
|
|
|
||
|
15 | let _ = (0..3).map(|x| 2 * x).fold(false, |acc, x| acc || x > 2);
|
||
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `.any(|x| x > 2)`
|
||
|
|
||
|
error: aborting due to 5 previous errors
|
||
|
|