]> git.lizzy.rs Git - rust.git/blob - src/tools/clippy/tests/ui/needless_for_each_unfixable.rs
Rollup merge of #102581 - jyn514:src-detection, r=Mark-Simulacrum
[rust.git] / src / tools / clippy / tests / ui / needless_for_each_unfixable.rs
1 #![warn(clippy::needless_for_each)]
2 #![allow(clippy::needless_return, clippy::uninlined_format_args)]
3
4 fn main() {
5     let v: Vec<i32> = Vec::new();
6     // This is unfixable because the closure includes `return`.
7     v.iter().for_each(|v| {
8         if *v == 10 {
9             return;
10         } else {
11             println!("{}", v);
12         }
13     });
14 }