We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 4b21223 commit 109abddCopy full SHA for 109abdd
rust/ql/examples/snippets/empty_if.ql
@@ -1,18 +1,18 @@
1
/**
2
- * @name Empty 'if' statement
3
- * @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
4
* "else" branch exists.
5
* @id rust/examples/empty-if
6
* @tags example
7
*/
8
9
import rust
10
11
-// find 'if' statements...
+// find 'if' expressions...
12
from IfExpr ifExpr
13
where
14
// where the 'then' branch is empty
15
ifExpr.getThen().getStmtList().getNumberOfStmtOrExpr() = 0 and
16
// and no 'else' branch exists
17
- not exists(ifExpr.getElse())
+ not ifExpr.hasElse()
18
select ifExpr, "This 'if' expression is redundant."
0 commit comments