]>
Commit | Line | Data |
---|---|---|
f2b60f7d FG |
1 | ### What it does |
2 | Checks for using `fold` when a more succinct alternative exists. | |
3 | Specifically, this checks for `fold`s which could be replaced by `any`, `all`, | |
4 | `sum` or `product`. | |
5 | ||
6 | ### Why is this bad? | |
7 | Readability. | |
8 | ||
9 | ### Example | |
10 | ``` | |
11 | (0..3).fold(false, |acc, x| acc || x > 2); | |
12 | ``` | |
13 | ||
14 | Use instead: | |
15 | ``` | |
16 | (0..3).any(|x| x > 2); | |
17 | ``` |