Skip to content

Commit 441500b

Browse files
committed
Refactor else_if_without_else: Check the AST before the macro check.
1 parent d15ec0f commit 441500b

File tree

1 file changed

+1
-4
lines changed

1 file changed

+1
-4
lines changed

clippy_lints/src/else_if_without_else.rs

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -50,12 +50,9 @@ declare_lint_pass!(ElseIfWithoutElse => [ELSE_IF_WITHOUT_ELSE]);
5050

5151
impl EarlyLintPass for ElseIfWithoutElse {
5252
fn check_expr(&mut self, cx: &EarlyContext<'_>, item: &Expr) {
53-
if in_external_macro(cx.sess(), item.span) {
54-
return;
55-
}
56-
5753
if let ExprKind::If(_, _, Some(ref els)) = item.kind
5854
&& let ExprKind::If(_, _, None) = els.kind
55+
&& !in_external_macro(cx.sess(), item.span)
5956
{
6057
span_lint_and_help(
6158
cx,

0 commit comments

Comments
 (0)