Apply suggestions from code review

Co-authored-by: Simon Friis Vindum <paldepind@github.com>
This commit is contained in:
Geoffrey White
2025-11-11 09:32:14 +00:00
committed by GitHub
parent 4b212239e1
commit 109abddc36

View File

@@ -1,6 +1,6 @@
/**
* @name Empty 'if' statement
* @description Finds 'if' statements where the "then" branch is empty and no
* @name Empty 'if' expression
* @description Finds 'if' expressions where the "then" branch is empty and no
* "else" branch exists.
* @id rust/examples/empty-if
* @tags example
@@ -8,11 +8,11 @@
import rust
// find 'if' statements...
// find 'if' expressions...
from IfExpr ifExpr
where
// where the 'then' branch is empty
ifExpr.getThen().getStmtList().getNumberOfStmtOrExpr() = 0 and
// and no 'else' branch exists
not exists(ifExpr.getElse())
not ifExpr.hasElse()
select ifExpr, "This 'if' expression is redundant."