diff options
| author | Lzu Tao <taolzu@gmail.com> | 2024-05-24 08:43:44 +0700 |
|---|---|---|
| committer | Lzu Tao <taolzu@gmail.com> | 2024-06-08 16:50:25 +0700 |
| commit | 0eb9f41a07ae7087d7f9ce557cbfcaa2b173c95a (patch) | |
| tree | 9d6241b66b48e97b455bacac636fad4600e9825c | |
| parent | 0ea88b90d8fbcb140314db4e689f8c78cc428907 (diff) | |
| download | rust-0eb9f41a07ae7087d7f9ce557cbfcaa2b173c95a.tar.gz rust-0eb9f41a07ae7087d7f9ce557cbfcaa2b173c95a.zip | |
make it more readable by faster early exitting
| -rw-r--r-- | clippy_lints/src/no_effect.rs | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/clippy_lints/src/no_effect.rs b/clippy_lints/src/no_effect.rs index 87f886b1128..dc017fa6634 100644 --- a/clippy_lints/src/no_effect.rs +++ b/clippy_lints/src/no_effect.rs @@ -258,10 +258,10 @@ fn has_no_effect(cx: &LateContext<'_>, expr: &Expr<'_>) -> bool { fn check_unnecessary_operation(cx: &LateContext<'_>, stmt: &Stmt<'_>) { if let StmtKind::Semi(expr) = stmt.kind + && !in_external_macro(cx.sess(), stmt.span) && let ctxt = stmt.span.ctxt() && expr.span.ctxt() == ctxt && let Some(reduced) = reduce_expression(cx, expr) - && !in_external_macro(cx.sess(), stmt.span) && reduced.iter().all(|e| e.span.ctxt() == ctxt) { if let ExprKind::Index(..) = &expr.kind { |
