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