diff --git a/rust/ql/src/queries/unusedentities/UnusedVariable.qll b/rust/ql/src/queries/unusedentities/UnusedVariable.qll index c0684636e77..64d49a547f1 100644 --- a/rust/ql/src/queries/unusedentities/UnusedVariable.qll +++ b/rust/ql/src/queries/unusedentities/UnusedVariable.qll @@ -43,4 +43,8 @@ predicate isAllowableUnused(Variable v) { or // 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 }