Files
rust/tests/ui/never_loop_iterator_reduction.rs
T
2025-12-12 10:01:58 +07:00

18 lines
325 B
Rust

//@no-rustfix
#![warn(clippy::never_loop)]
fn main() {
// diverging closure: should trigger
[0, 1].into_iter().for_each(|x| {
//~^ never_loop
let _ = x;
panic!("boom");
});
// benign closure: should NOT trigger
[0, 1].into_iter().for_each(|x| {
let _ = x + 1;
});
}