]> git.lizzy.rs Git - rust.git/blob - src/docs/suspicious_map.txt
Merge remote-tracking branch 'upstream/master' into rustup
[rust.git] / src / docs / suspicious_map.txt
1 ### What it does
2 Checks for calls to `map` followed by a `count`.
3
4 ### Why is this bad?
5 It looks suspicious. Maybe `map` was confused with `filter`.
6 If the `map` call is intentional, this should be rewritten
7 using `inspect`. Or, if you intend to drive the iterator to
8 completion, you can just use `for_each` instead.
9
10 ### Example
11 ```
12 let _ = (0..3).map(|x| x + 2).count();
13 ```