mirror of
https://github.com/rust-lang/rust.git
synced 2026-05-08 01:28:18 +03:00
18 lines
325 B
Rust
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;
|
|
});
|
|
}
|