RS.CLIPPY.MAP_COLLECT_RESULT_UNIT

Using `.map(_).collect::<Result<(),_>()`, which can be replaced with `try_for_each`

This checker is a Clippy lint created by The Rust Project Contributors. The documentation shown here is a copy of the original documentation for: map_collect_result_unit. Copyright ©2025 The Rust Team. All rights reserved.

What it does

Checks for usage of _.map(_).collect::<Result<(), _>().

Why is this bad?

Using try_for_each instead is more readable and idiomatic.

Example

(0..3).map(|t| Err(t)).collect::<Result<(), _>>();

Use instead:

(0..3).try_for_each(|t| Err(t));