RS.CLIPPY.FILTER_MAP_IDENTITY

Call to `filter_map` where `flatten` is sufficient

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

What it does

Checks for usage of filter_map(|x| x).

Why is this bad?

Readability, this can be written more concisely by using flatten.

Example

iter.filter_map(|x| x);

Use instead:

iter.flatten();