about summary refs log tree commit diff
path: root/src/tools/clippy/tests/ui/unnecessary_fold.stderr
blob: d82b1f39b48bbb8b62472399fdbd4ff5604e5231 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
error: this `.fold` can be written more succinctly using another method
  --> tests/ui/unnecessary_fold.rs:10: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`
   = help: to override `-D warnings` add `#[allow(clippy::unnecessary_fold)]`

error: redundant closure
  --> tests/ui/unnecessary_fold.rs:13:32
   |
LL |     let _ = (0..3).fold(false, |acc, x| is_any(acc, x));
   |                                ^^^^^^^^^^^^^^^^^^^^^^^ help: replace the closure with the function itself: `is_any`
   |
   = note: `-D clippy::redundant-closure` implied by `-D warnings`
   = help: to override `-D warnings` add `#[allow(clippy::redundant_closure)]`

error: this `.fold` can be written more succinctly using another method
  --> tests/ui/unnecessary_fold.rs:16: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
  --> tests/ui/unnecessary_fold.rs:19: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
  --> tests/ui/unnecessary_fold.rs:22: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
  --> tests/ui/unnecessary_fold.rs:28:41
   |
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
  --> tests/ui/unnecessary_fold.rs:59:10
   |
LL |         .fold(false, |acc, x| acc || x > 2);
   |          ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `any(|x| x > 2)`

error: this `.fold` can be written more succinctly using another method
  --> tests/ui/unnecessary_fold.rs:71:33
   |
LL |         assert_eq!(map.values().fold(0, |x, y| x + y), 0);
   |                                 ^^^^^^^^^^^^^^^^^^^^^ help: try: `sum::<i32>()`

error: this `.fold` can be written more succinctly using another method
  --> tests/ui/unnecessary_fold.rs:75:30
   |
LL |         let _ = map.values().fold(0, |x, y| x + y);
   |                              ^^^^^^^^^^^^^^^^^^^^^ help: try: `sum::<i32>()`

error: this `.fold` can be written more succinctly using another method
  --> tests/ui/unnecessary_fold.rs:77:30
   |
LL |         let _ = map.values().fold(1, |x, y| x * y);
   |                              ^^^^^^^^^^^^^^^^^^^^^ help: try: `product::<i32>()`

error: this `.fold` can be written more succinctly using another method
  --> tests/ui/unnecessary_fold.rs:79:35
   |
LL |         let _: i32 = map.values().fold(0, |x, y| x + y);
   |                                   ^^^^^^^^^^^^^^^^^^^^^ help: try: `sum()`

error: this `.fold` can be written more succinctly using another method
  --> tests/ui/unnecessary_fold.rs:81:35
   |
LL |         let _: i32 = map.values().fold(1, |x, y| x * y);
   |                                   ^^^^^^^^^^^^^^^^^^^^^ help: try: `product()`

error: this `.fold` can be written more succinctly using another method
  --> tests/ui/unnecessary_fold.rs:83:31
   |
LL |         anything(map.values().fold(0, |x, y| x + y));
   |                               ^^^^^^^^^^^^^^^^^^^^^ help: try: `sum::<i32>()`

error: this `.fold` can be written more succinctly using another method
  --> tests/ui/unnecessary_fold.rs:85:31
   |
LL |         anything(map.values().fold(1, |x, y| x * y));
   |                               ^^^^^^^^^^^^^^^^^^^^^ help: try: `product::<i32>()`

error: this `.fold` can be written more succinctly using another method
  --> tests/ui/unnecessary_fold.rs:87:26
   |
LL |         num(map.values().fold(0, |x, y| x + y));
   |                          ^^^^^^^^^^^^^^^^^^^^^ help: try: `sum()`

error: this `.fold` can be written more succinctly using another method
  --> tests/ui/unnecessary_fold.rs:89:26
   |
LL |         num(map.values().fold(1, |x, y| x * y));
   |                          ^^^^^^^^^^^^^^^^^^^^^ help: try: `product()`

error: aborting due to 16 previous errors