Skip to content

Commit fe139e5

Browse files
committed
Rust: Rearrange the unused variable query logic so that it's clearer what the comments apply to.
1 parent cc902a6 commit fe139e5

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

rust/ql/src/queries/unusedentities/UnusedValue.ql

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -16,11 +16,11 @@ import UnusedVariable
1616
from AstNode write, Ssa::Variable v
1717
where
1818
variableWrite(write, v) and
19+
not v instanceof DiscardVariable and
20+
not write.isInMacroExpansion() and
21+
not isAllowableUnused(v) and
1922
// SSA definitions are only created for live writes
2023
not write = any(Ssa::WriteDefinition def).getWriteAccess().getAstNode() and
2124
// avoid overlap with the unused variable query
22-
not isUnused(v) and
23-
not v instanceof DiscardVariable and
24-
not write.isInMacroExpansion() and
25-
not isAllowableUnused(v)
25+
not isUnused(v)
2626
select write, "Variable $@ is assigned a value that is never used.", v, v.getText()

0 commit comments

Comments
 (0)