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

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);
        }
    });
}