mirror of
https://github.com/github/codeql.git
synced 2026-04-27 09:45:15 +02:00
Rust: Fix the unwanted results.
This commit is contained in:
@@ -23,4 +23,7 @@ predicate isUnused(Variable v) {
|
||||
predicate isAllowableUnused(Variable v) {
|
||||
// in a macro expansion
|
||||
v.getPat().isInMacroExpansion()
|
||||
or
|
||||
// a 'self' variable
|
||||
v.getName() = "self"
|
||||
}
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
| main.rs:29:9:29:9 | a | Variable 'a' is not used. |
|
||||
| main.rs:89:19:89:22 | self | Variable 'self' is not used. |
|
||||
| main.rs:98:13:98:13 | d | Variable 'd' is not used. |
|
||||
| main.rs:147:5:147:5 | y | Variable 'y' is not used. |
|
||||
| main.rs:174:9:174:9 | x | Variable 'x' is not used. |
|
||||
|
||||
@@ -86,7 +86,7 @@ impl MyStruct {
|
||||
return self.val;
|
||||
}
|
||||
|
||||
fn get_flags(&self) -> i64 { // $ SPURIOUS: Alert[rust/unused-variable]
|
||||
fn get_flags(&self) -> i64 {
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user