🌐 AI搜索 & 代理 主页
Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions rust/ql/src/change-notes/2025-12-10-unused-variable.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
---
category: minorAnalysis
---
* Fixed common false positives for the `rust/unused-variable` and `rust/unused-value` queries.
6 changes: 6 additions & 0 deletions rust/ql/src/queries/unusedentities/UnusedVariable.qll
Original file line number Diff line number Diff line change
Expand Up @@ -43,4 +43,10 @@ predicate isAllowableUnused(Variable v) {
or
// a 'self' variable
v.getText() = "self"
or
// a common source of false positives is match arms containing constants
// (typically beginning with a capital letter) that are misrecognized as a
// variable, having not been correctly resolved.
v.getPat().getParentNode() instanceof MatchArm and
v.getText().charAt(0).isUppercase()
}
Loading