@@ -58,18 +58,18 @@ impl<'a, 'tcx> LateLintPass<'a, 'tcx> for IdentityOp {
58
58
}
59
59
}
60
60
61
- fn no_zeros ( v : & ConstInt ) -> bool {
61
+ fn all_ones ( v : & ConstInt ) -> bool {
62
62
match * v {
63
- ConstInt :: I8 ( i) => i. count_zeros ( ) == 0 ,
64
- ConstInt :: I16 ( i) => i. count_zeros ( ) == 0 ,
65
- ConstInt :: I32 ( i) => i. count_zeros ( ) == 0 ,
66
- ConstInt :: I64 ( i) => i. count_zeros ( ) == 0 ,
67
- ConstInt :: I128 ( i) => i. count_zeros ( ) == 0 ,
68
- ConstInt :: U8 ( i) => i. count_zeros ( ) == 0 ,
69
- ConstInt :: U16 ( i) => i. count_zeros ( ) == 0 ,
70
- ConstInt :: U32 ( i) => i. count_zeros ( ) == 0 ,
71
- ConstInt :: U64 ( i) => i. count_zeros ( ) == 0 ,
72
- ConstInt :: U128 ( i) => i. count_zeros ( ) == 0 ,
63
+ ConstInt :: I8 ( i) => i == ! 0 ,
64
+ ConstInt :: I16 ( i) => i == ! 0 ,
65
+ ConstInt :: I32 ( i) => i == ! 0 ,
66
+ ConstInt :: I64 ( i) => i == ! 0 ,
67
+ ConstInt :: I128 ( i) => i == ! 0 ,
68
+ ConstInt :: U8 ( i) => i == ! 0 ,
69
+ ConstInt :: U16 ( i) => i == ! 0 ,
70
+ ConstInt :: U32 ( i) => i == ! 0 ,
71
+ ConstInt :: U64 ( i) => i == ! 0 ,
72
+ ConstInt :: U128 ( i) => i == ! 0 ,
73
73
_ => false
74
74
}
75
75
}
@@ -79,7 +79,7 @@ fn check(cx: &LateContext, e: &Expr, m: i8, span: Span, arg: Span) {
79
79
if let Some ( Constant :: Int ( v) ) = constant_simple ( cx, e) {
80
80
if match m {
81
81
0 => v. to_u128_unchecked ( ) == 0 ,
82
- -1 => no_zeros ( & v) ,
82
+ -1 => all_ones ( & v) ,
83
83
1 => v. to_u128_unchecked ( ) == 1 ,
84
84
_ => unreachable ! ( ) ,
85
85
} {
0 commit comments