mirror of
https://github.com/github/codeql.git
synced 2025-12-17 01:03:14 +01:00
Rust: Move the function pointer parameter exclusion into VariableImpl.qll.
This commit is contained in:
@@ -87,7 +87,9 @@ module Impl {
|
||||
not name.charAt(0).isUppercase() and
|
||||
// exclude parameters from functions without a body as these are trait method declarations
|
||||
// without implementations
|
||||
not exists(Function f | not f.hasBody() and f.getParamList().getAParam().getPat() = p)
|
||||
not exists(Function f | not f.hasBody() and f.getParamList().getAParam().getPat() = p) and
|
||||
// exclude parameters from function pointers as well, which also lack a body
|
||||
not exists(FnPtrType fp | fp.getParamList().getParam(_).getPat() = p)
|
||||
}
|
||||
|
||||
/** A variable. */
|
||||
|
||||
@@ -23,7 +23,4 @@ predicate isUnused(Variable v) {
|
||||
predicate isAllowableUnused(Variable v) {
|
||||
// in a macro expansion
|
||||
v.getPat().isInMacroExpansion()
|
||||
or
|
||||
// function pointer parameters
|
||||
exists(FnPtrType fp | fp.getParamList().getParam(_).getPat() = v.getPat())
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user