rust-lang/rust-clippy

Always true expressions in if expressions

Open

#1593 aperta il 3 mar 2017

Vedi su GitHub
 (3 commenti) (0 reazioni) (1 assegnatario)Rust (1391 fork)batch import
A-lintL-correctnessT-middlegood first issue

Metriche repository

Star
 (10.406 star)
Metriche merge PR
 (Merge medio 19g 22h) (113 PR mergiate in 30 g)

Descrizione

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
}

Guida contributor