]> git.lizzy.rs Git - rust.git/blobdiff - tests/ui/unnecessary_fold.stderr
iterate List by value
[rust.git] / tests / ui / unnecessary_fold.stderr
index e72f671b67ec0d008a2ad64830bb1c1c7f83813f..22c44588ab7af879b9a7b27d828144c55a9f59e8 100644 (file)
@@ -1,34 +1,40 @@
 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 clippy::unnecessary-fold` implied by `-D warnings`
+  --> $DIR/unnecessary_fold.rs:8:20
+   |
+LL |     let _ = (0..3).fold(false, |acc, x| acc || x > 2);
+   |                    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `any(|x| x > 2)`
+   |
+   = note: `-D clippy::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)`
+  --> $DIR/unnecessary_fold.rs:10:20
+   |
+LL |     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()`
+  --> $DIR/unnecessary_fold.rs:12:25
+   |
+LL |     let _: i32 = (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:14:25
+   |
+LL |     let _: i32 = (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:10:19
+  --> $DIR/unnecessary_fold.rs:19:41
    |
-10 |     let _ = (0..3).fold(1, |acc, x| acc * x);
-   |                   ^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `.product()`
+LL |     let _: bool = (0..3).map(|x| 2 * x).fold(false, |acc, x| acc || x > 2);
+   |                                         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `any(|x| x > 2)`
 
 error: this `.fold` can be written more succinctly using another method
-  --> $DIR/unnecessary_fold.rs:15:34
+  --> $DIR/unnecessary_fold.rs:49:10
    |
-15 |     let _ = (0..3).map(|x| 2 * x).fold(false, |acc, x| acc || x > 2);
-   |                                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `.any(|x| x > 2)`
+LL |         .fold(false, |acc, x| acc || x > 2);
+   |          ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `any(|x| x > 2)`
 
-error: aborting due to 5 previous errors
+error: aborting due to 6 previous errors