Add a lint to suggest uint == 0 over uint <= 0

This commit is contained in:
scurest 2016-01-29 00:39:13 -06:00
parent 5402ef3d27
commit e48fbba864
5 changed files with 71 additions and 2 deletions

View file

@ -0,0 +1,14 @@
#![feature(plugin)]
#![plugin(clippy)]
#![allow(unused)]
#[deny(absurd_unsigned_comparisons)]
fn main() {
1u32 <= 0; //~ERROR testing whether an unsigned integer is non-positive
1u8 <= 0; //~ERROR testing whether an unsigned integer is non-positive
1i32 <= 0;
0 >= 1u32; //~ERROR testing whether an unsigned integer is non-positive
0 >= 1;
1u32 > 0;
}