RS.CLIPPY.MANUAL_FIND_MAP

Using `_.find(_).map(_)` in a way that can be written more simply as `find_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_find_map. Copyright ©2025 The Rust Team. All rights reserved.

What it does

Checks for usage of _.find(_).map(_) that can be written more simply as find_map(_).

Why is this bad?

Redundant code in the find and map operations is poor style and less performant.

Example

(0_i32..10)
    .find(|n| n.checked_add(1).is_some())
    .map(|n| n.checked_add(1).unwrap());

Use instead:

(0_i32..10).find_map(|n| n.checked_add(1));

Past names

  • find_map