rust-lang/rust-clippy

Always true expressions in if expressions

Open

#1,593 创建于 2017年3月3日

在 GitHub 查看
 (3 评论) (0 反应) (1 负责人)Rust (1,391 fork)batch import
A-lintL-correctnessT-middlegood first issue

仓库指标

Star
 (10,406 star)
PR 合并指标
 (平均合并 19天 22小时) (30 天内合并 113 个 PR)

描述

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
}

贡献者指南