From a21108a2963c63310d9c5b452e7faf3e622c47de Mon Sep 17 00:00:00 2001 From: Manish Goregaokar Date: Fri, 8 Jan 2016 21:21:12 +0530 Subject: [PATCH] Stronger macro check --- src/block_in_if_condition.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/block_in_if_condition.rs b/src/block_in_if_condition.rs index f7d8c95ee..53f11366c 100644 --- a/src/block_in_if_condition.rs +++ b/src/block_in_if_condition.rs @@ -80,7 +80,7 @@ impl LateLintPass for BlockInIfCondition { if let Some(ref ex) = block.expr { // don't dig into the expression here, just suggest that they remove // the block - if differing_macro_contexts(expr.span, ex.span) { + if in_macro(cx, expr.span) || differing_macro_contexts(expr.span, ex.span) { return; } span_help_and_lint(cx, @@ -92,7 +92,7 @@ impl LateLintPass for BlockInIfCondition { snippet_block(cx, then.span, ".."))); } } else { - if differing_macro_contexts(expr.span, block.stmts[0].span) { + if in_macro(cx, expr.span) || differing_macro_contexts(expr.span, block.stmts[0].span) { return; } // move block higher