fork/rust

git clone https://git.julia.blue/fork/rust

borsAuto merge of #103046 - JanBeh:PR_clarify_cmp_terminology, r=workingjubilee3bcad65fbf6

master
4.0 KiB95 linesraw
1error: this `.fold` can be written more succinctly using another method
2  --> $DIR/unnecessary_fold.rs:6:20
3   |
4LL |     let _ = (0..3).fold(false, |acc, x| acc || x > 2);
5   |                    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `any(|x| x > 2)`
6   |
7   = note: `-D clippy::unnecessary-fold` implied by `-D warnings`
8   = help: to override `-D warnings` add `#[allow(clippy::unnecessary_fold)]`
9
10error: this `.fold` can be written more succinctly using another method
11  --> $DIR/unnecessary_fold.rs:8:20
12   |
13LL |     let _ = (0..3).fold(true, |acc, x| acc && x > 2);
14   |                    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `all(|x| x > 2)`
15
16error: this `.fold` can be written more succinctly using another method
17  --> $DIR/unnecessary_fold.rs:10:25
18   |
19LL |     let _: i32 = (0..3).fold(0, |acc, x| acc + x);
20   |                         ^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `sum()`
21
22error: this `.fold` can be written more succinctly using another method
23  --> $DIR/unnecessary_fold.rs:12:25
24   |
25LL |     let _: i32 = (0..3).fold(1, |acc, x| acc * x);
26   |                         ^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `product()`
27
28error: this `.fold` can be written more succinctly using another method
29  --> $DIR/unnecessary_fold.rs:17:41
30   |
31LL |     let _: bool = (0..3).map(|x| 2 * x).fold(false, |acc, x| acc || x > 2);
32   |                                         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `any(|x| x > 2)`
33
34error: this `.fold` can be written more succinctly using another method
35  --> $DIR/unnecessary_fold.rs:47:10
36   |
37LL |         .fold(false, |acc, x| acc || x > 2);
38   |          ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `any(|x| x > 2)`
39
40error: this `.fold` can be written more succinctly using another method
41  --> $DIR/unnecessary_fold.rs:58:33
42   |
43LL |         assert_eq!(map.values().fold(0, |x, y| x + y), 0);
44   |                                 ^^^^^^^^^^^^^^^^^^^^^ help: try: `sum::<i32>()`
45
46error: this `.fold` can be written more succinctly using another method
47  --> $DIR/unnecessary_fold.rs:61:30
48   |
49LL |         let _ = map.values().fold(0, |x, y| x + y);
50   |                              ^^^^^^^^^^^^^^^^^^^^^ help: try: `sum::<i32>()`
51
52error: this `.fold` can be written more succinctly using another method
53  --> $DIR/unnecessary_fold.rs:62:30
54   |
55LL |         let _ = map.values().fold(1, |x, y| x * y);
56   |                              ^^^^^^^^^^^^^^^^^^^^^ help: try: `product::<i32>()`
57
58error: this `.fold` can be written more succinctly using another method
59  --> $DIR/unnecessary_fold.rs:63:35
60   |
61LL |         let _: i32 = map.values().fold(0, |x, y| x + y);
62   |                                   ^^^^^^^^^^^^^^^^^^^^^ help: try: `sum()`
63
64error: this `.fold` can be written more succinctly using another method
65  --> $DIR/unnecessary_fold.rs:64:35
66   |
67LL |         let _: i32 = map.values().fold(1, |x, y| x * y);
68   |                                   ^^^^^^^^^^^^^^^^^^^^^ help: try: `product()`
69
70error: this `.fold` can be written more succinctly using another method
71  --> $DIR/unnecessary_fold.rs:65:31
72   |
73LL |         anything(map.values().fold(0, |x, y| x + y));
74   |                               ^^^^^^^^^^^^^^^^^^^^^ help: try: `sum::<i32>()`
75
76error: this `.fold` can be written more succinctly using another method
77  --> $DIR/unnecessary_fold.rs:66:31
78   |
79LL |         anything(map.values().fold(1, |x, y| x * y));
80   |                               ^^^^^^^^^^^^^^^^^^^^^ help: try: `product::<i32>()`
81
82error: this `.fold` can be written more succinctly using another method
83  --> $DIR/unnecessary_fold.rs:67:26
84   |
85LL |         num(map.values().fold(0, |x, y| x + y));
86   |                          ^^^^^^^^^^^^^^^^^^^^^ help: try: `sum()`
87
88error: this `.fold` can be written more succinctly using another method
89  --> $DIR/unnecessary_fold.rs:68:26
90   |
91LL |         num(map.values().fold(1, |x, y| x * y));
92   |                          ^^^^^^^^^^^^^^^^^^^^^ help: try: `product()`
93
94error: aborting due to 15 previous errors
95