Rust: Narrow the exclusion a little.

This commit is contained in:
Geoffrey White
2025-12-11 17:57:16 +00:00
parent f1d241f810
commit d88bae9ec2
3 changed files with 7 additions and 4 deletions

View File

@@ -44,7 +44,9 @@ predicate isAllowableUnused(Variable v) {
// a 'self' variable
v.getText() = "self"
or
// a common source of false positives is match arms that are misrecognized as
// a variable, having not been correctly resolved
v.getPat().getParentNode() instanceof MatchArm
// 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()
}