RS.CLIPPY.MANUAL_INSPECT

Use of `map` returning the original item

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_inspect. Copyright ©2025 The Rust Team. All rights reserved.

What it does

Checks for uses of map which return the original item.

Why is this bad?

inspect is both clearer in intent and shorter.

Example

let x = Some(0).map(|x| { println!("{x}"); x });

Use instead:

let x = Some(0).inspect(|x| println!("{x}"));