rust-lang/rust-clippy
View on GitHubNew lint: `while let Some(&x) = slice.iter().next()` is infinite loop
Open
#4554 opened on Sep 19, 2019
A-lintL-correctnessL-suggestiongood first issue
Description
This code is an infinite loop: (Do not run this in playpen)
fn main() {
let a = [1, 2, 3];
while let Some(&x) = a.iter().next() {
println!("{:?}", x);
}
}