]> git.lizzy.rs Git - rust.git/blob - src/docs/map_collect_result_unit.txt
Merge remote-tracking branch 'upstream/master' into rustup
[rust.git] / src / docs / map_collect_result_unit.txt
1 ### What it does
2 Checks for usage of `_.map(_).collect::<Result<(), _>()`.
3
4 ### Why is this bad?
5 Using `try_for_each` instead is more readable and idiomatic.
6
7 ### Example
8 ```
9 (0..3).map(|t| Err(t)).collect::<Result<(), _>>();
10 ```
11 Use instead:
12 ```
13 (0..3).try_for_each(|t| Err(t));
14 ```