Skip to content

Commit 31f7943

Browse files
committed
make it more readable by faster early exitting
1 parent 76856ff commit 31f7943

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

clippy_lints/src/no_effect.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -258,10 +258,10 @@ fn has_no_effect(cx: &LateContext<'_>, expr: &Expr<'_>) -> bool {
258258

259259
fn check_unnecessary_operation(cx: &LateContext<'_>, stmt: &Stmt<'_>) {
260260
if let StmtKind::Semi(expr) = stmt.kind
261+
&& !in_external_macro(cx.sess(), stmt.span)
261262
&& let ctxt = stmt.span.ctxt()
262263
&& expr.span.ctxt() == ctxt
263264
&& let Some(reduced) = reduce_expression(cx, expr)
264-
&& !in_external_macro(cx.sess(), stmt.span)
265265
&& reduced.iter().all(|e| e.span.ctxt() == ctxt)
266266
{
267267
if let ExprKind::Index(..) = &expr.kind {

0 commit comments

Comments
 (0)