RS.CLIPPY.MANUAL_FILTER_MAP
Using `_.filter(_).map(_)` in a way that can be written more simply as `filter_map(_)`
This checker is a Clippy lint created by The Rust Project Contributors. The documentation shown here is a copy of the original documentation for: manual_filter_map. Copyright ©2025 The Rust Team. All rights reserved.
What it does
Checks for usage of _.filter(_).map(_) that can be written more simply
as filter_map(_).
Why is this bad?
Redundant code in the filter and map operations is poor style and
less performant.
Example
(0_i32..10)
.filter(|n| n.checked_add(1).is_some())
.map(|n| n.checked_add(1).unwrap());
Use instead:
(0_i32..10).filter_map(|n| n.checked_add(1));
Past names
- filter_map