RS.CLIPPY.MANUAL_FILTER

Reimplementation of `filter`

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

What it does

Checks for usage of match which could be implemented using filter

Why is this bad?

Using the filter method is clearer and more concise.

Example

match Some(0) {
    Some(x) => if x % 2 == 0 {
                    Some(x)
               } else {
                    None
                },
    None => None,
};

Use instead:

Some(0).filter(|&x| x % 2 == 0);