]> git.lizzy.rs Git - rust.git/commitdiff
Cleanup
authormcarton <cartonmartin+git@gmail.com>
Sun, 5 Jun 2016 23:16:16 +0000 (01:16 +0200)
committermcarton <cartonmartin+git@gmail.com>
Thu, 9 Jun 2016 22:08:14 +0000 (00:08 +0200)
clippy_lints/src/bit_mask.rs

index aec0990dcc68ac24a2975305121720852b5fd27e..f1e427c5c61574631efb774d2d650fd9580cb44e 100644 (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)
+                }
             }
         }
     }