rust-lang/rust-clippy

New lint: `while let Some(&x) = slice.iter().next()` is infinite loop

Open

#4,554 建立於 2019年9月19日

在 GitHub 查看
 (12 留言) (0 反應) (1 負責人)Rust (1,391 fork)batch import
A-lintL-correctnessL-suggestiongood first issue

倉庫指標

Star
 (10,406 star)
PR 合併指標
 (平均合併 19天 22小時) (30 天內合併 113 個 PR)

描述

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);
    }
}

貢獻者指南