]> git.lizzy.rs Git - rust.git/commitdiff
Small cleanup
authormcarton <cartonmartin+git@gmail.com>
Sun, 7 Feb 2016 13:40:45 +0000 (14:40 +0100)
committermcarton <cartonmartin+git@gmail.com>
Sun, 7 Feb 2016 13:40:45 +0000 (14:40 +0100)
src/copies.rs

index 84324dffc8591a9063033be506a1684428bb0926..525c7b7a6fde2e8acd5c6209deef94f69447bab6 100644 (file)
@@ -54,15 +54,10 @@ fn check_expr(&mut self, cx: &LateContext, expr: &Expr) {
 /// Implementation of `IF_SAME_THEN_ELSE`.
 fn lint_same_then_else(cx: &LateContext, expr: &Expr) {
     if let ExprIf(_, ref then_block, Some(ref else_expr)) = expr.node {
-        let must_lint = if let ExprBlock(ref else_block) = else_expr.node {
-            is_block_equal(cx, &then_block, &else_block, false)
-        }
-        else {
-            false
-        };
-
-        if must_lint {
-            span_lint(cx, IF_SAME_THEN_ELSE, expr.span, "this if has the same then and else blocks");
+        if let ExprBlock(ref else_block) = else_expr.node {
+            if is_block_equal(cx, &then_block, &else_block, false) {
+                span_lint(cx, IF_SAME_THEN_ELSE, expr.span, "this if has the same then and else blocks");
+            }
         }
     }
 }