rust-lang/rust-clippy
在 GitHub 查看New lint: `while let Some(&x) = slice.iter().next()` is infinite loop
Open
#4,554 建立於 2019年9月19日
A-lintL-correctnessL-suggestiongood first issue
描述
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);
}
}