diff --git a/rust/ql/src/queries/unusedentities/UnusedVariable.qll b/rust/ql/src/queries/unusedentities/UnusedVariable.qll index e52b836823b3..020b559c2765 100644 --- a/rust/ql/src/queries/unusedentities/UnusedVariable.qll +++ b/rust/ql/src/queries/unusedentities/UnusedVariable.qll @@ -10,6 +10,5 @@ predicate isUnused(Variable v) { not exists(v.getAnAccess()) and not exists(v.getInitializer()) and not v instanceof DiscardVariable and - not v.getPat().isInMacroExpansion() and - exists(File f | f.getBaseName() = "main.rs" | v.getLocation().getFile() = f) // temporarily severely limit results + not v.getPat().isInMacroExpansion() } diff --git a/rust/ql/test/query-tests/unusedentities/UnusedValue.expected b/rust/ql/test/query-tests/unusedentities/UnusedValue.expected index 5b438d4c0de9..420ffcee1448 100644 --- a/rust/ql/test/query-tests/unusedentities/UnusedValue.expected +++ b/rust/ql/test/query-tests/unusedentities/UnusedValue.expected @@ -14,7 +14,6 @@ | main.rs:270:13:270:17 | total | Variable $@ is assigned a value that is never used. | main.rs:238:13:238:17 | total | total | | main.rs:363:9:363:9 | x | Variable $@ is assigned a value that is never used. | main.rs:363:9:363:9 | x | x | | main.rs:371:17:371:17 | x | Variable $@ is assigned a value that is never used. | main.rs:371:17:371:17 | x | x | -| more.rs:24:9:24:11 | val | Variable $@ is assigned a value that is never used. | more.rs:24:9:24:11 | val | val | | more.rs:44:9:44:14 | a_ptr4 | Variable $@ is assigned a value that is never used. | more.rs:44:9:44:14 | a_ptr4 | a_ptr4 | | more.rs:59:9:59:13 | d_ptr | Variable $@ is assigned a value that is never used. | more.rs:59:9:59:13 | d_ptr | d_ptr | | more.rs:65:9:65:17 | f_ptr | Variable $@ is assigned a value that is never used. | more.rs:65:13:65:17 | f_ptr | f_ptr | diff --git a/rust/ql/test/query-tests/unusedentities/UnusedVariable.expected b/rust/ql/test/query-tests/unusedentities/UnusedVariable.expected index 293fc4d9fed7..7f459575f02e 100644 --- a/rust/ql/test/query-tests/unusedentities/UnusedVariable.expected +++ b/rust/ql/test/query-tests/unusedentities/UnusedVariable.expected @@ -19,3 +19,4 @@ | main.rs:417:26:417:28 | val | Variable 'val' is not used. | | main.rs:420:21:420:23 | acc | Variable 'acc' is not used. | | main.rs:441:9:441:14 | unused | Variable 'unused' is not used. | +| more.rs:24:9:24:11 | val | Variable 'val' is not used. | diff --git a/rust/ql/test/query-tests/unusedentities/more.rs b/rust/ql/test/query-tests/unusedentities/more.rs index cb33d5f40fc7..4788575b9de1 100644 --- a/rust/ql/test/query-tests/unusedentities/more.rs +++ b/rust/ql/test/query-tests/unusedentities/more.rs @@ -21,7 +21,7 @@ impl MySettable for MyContainer { impl MyGettable for MyContainer { fn get( &self, - val: T, // $ SPURIOUS: Alert[rust/unused-value] $ MISSING: Alert[rust/unused-variable] + val: T, // $ Alert[rust/unused-variable] ) -> &T { return &(self.val); }