This commit is contained in:
mcarton 2016-06-06 01:16:16 +02:00
parent e6832317fa
commit cca6eb2e2b
No known key found for this signature in database
GPG Key ID: 5E427C794CBA45E8
1 changed files with 5 additions and 10 deletions

View File

@ -91,16 +91,11 @@ impl LateLintPass for BitMask {
fn check_expr(&mut self, cx: &LateContext, e: &Expr) {
if let ExprBinary(ref cmp, ref left, ref right) = e.node {
if cmp.node.is_comparison() {
fetch_int_literal(cx, right).map_or_else(|| {
fetch_int_literal(cx, left).map_or((), |cmp_val| {
check_compare(cx,
right,
invert_cmp(cmp.node),
cmp_val,
&e.span)
})
},
|cmp_opt| check_compare(cx, left, cmp.node, cmp_opt, &e.span))
if let Some(cmp_opt) = fetch_int_literal(cx, right) {
check_compare(cx, left, cmp.node, cmp_opt, &e.span)
} else if let Some(cmp_val) = fetch_int_literal(cx, left) {
check_compare(cx, right, invert_cmp(cmp.node), cmp_val, &e.span)
}
}
}
}