Rust: Fix the unwanted results.

This commit is contained in:
Geoffrey White
2024-12-06 12:29:07 +00:00
parent e52e1b0c1f
commit 281f8b1828
3 changed files with 4 additions and 2 deletions

View File

@@ -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"
}

View File

@@ -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. |

View File

@@ -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;
}
}