This commit is contained in:
llogiq 2016-01-31 23:25:10 +01:00
parent 5402ef3d27
commit a2ad0c6695
2 changed files with 15 additions and 2 deletions

View file

@ -92,7 +92,9 @@ impl LateLintPass for BlockInIfCondition {
snippet_block(cx, then.span, "..")));
}
} else {
if in_macro(cx, expr.span) || differing_macro_contexts(expr.span, block.stmts[0].span) {
let span = block.expr.as_ref().map_or_else(|| block.stmts[0].span,
|e| e.span);
if in_macro(cx, span) || differing_macro_contexts(expr.span, span) {
return;
}
// move block higher