RS.CLIPPY.FILTER_NEXT

Using `filter(p).next()`, which is more succinctly expressed as `.find(p)`

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

What it does

Checks for usage of _.filter(_).next().

Why is this bad?

Readability, this can be written more concisely as _.find(_).

Example

vec.iter().filter(|x| **x == 0).next();

Use instead:

vec.iter().find(|x| **x == 0);