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 84b5060 commit 6ce0a0dCopy full SHA for 6ce0a0d
rust/ql/examples/snippets/empty_if.ql
@@ -0,0 +1,15 @@
1
+/**
2
+ * @name Empty 'if' statement
3
+ * @description Finds 'if' statements 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
+from IfExpr ifExpr
12
+where
13
+ ifExpr.getThen().(BlockExpr).getStmtList().getNumberOfStmtOrExpr() = 0 and
14
+ not exists(ifExpr.getElse())
15
+select ifExpr, "This 'if' expression is redundant."
0 commit comments