summaryrefslogtreecommitdiffstats
path: root/src/tools/clippy/tests/ui/needless_for_each_unfixable.rs
blob: d765d7dab65c90c26571df73ef9fac4743c1cbdf (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
#![warn(clippy::needless_for_each)]
#![allow(clippy::needless_return)]

fn main() {
    let v: Vec<i32> = Vec::new();
    // This is unfixable because the closure includes `return`.
    v.iter().for_each(|v| {
        if *v == 10 {
            return;
        } else {
            println!("{}", v);
        }
    });
}