rust-lang/rust-clippy

Always true expressions in if expressions

Open

#1,593 opened on 2017年3月3日

GitHub で見る
 (3 comments) (0 reactions) (1 assignee)Rust (1,391 forks)batch import
A-lintL-correctnessT-middlegood first issue

Repository metrics

Stars
 (10,406 stars)
PR merge metrics
 (平均マージ 19d 22h) (30d で 113 merged PRs)

説明

I'd like Clippy to find this problem in the code, this expression is always true, and Clippy should also suggest the usage of && here instead:

fn foo1a(name: &str) {
    if name != "Min" || name != "Max" {}
}

Another example:

fn foo1b(x: i32) -> bool {
    x > 10 || x < 25
}

コントリビューターガイド