-
Notifications
You must be signed in to change notification settings - Fork 1.6k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
6 changed files
with
115 additions
and
73 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
import rust | ||
|
||
/** A deliberately unused variable. */ | ||
class DiscardVariable extends Variable { | ||
DiscardVariable() { this.getName().charAt(0) = "_" } | ||
} | ||
|
||
/** Holds if variable `v` is unused. */ | ||
predicate isUnused(Variable v) { | ||
not exists(v.getAnAccess()) and | ||
not exists(v.getInitializer()) and | ||
not v instanceof DiscardVariable and | ||
exists(File f | f.getBaseName() = "main.rs" | v.getLocation().getFile() = f) // temporarily severely limit results | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
| main.rs:6:9:6:9 | a | Variable is assigned a value that is never used. | | ||
| main.rs:7:9:7:9 | b | Variable is assigned a value that is never used. | | ||
| main.rs:8:9:8:9 | c | Variable is assigned a value that is never used. | | ||
| main.rs:9:9:9:9 | d | Variable is assigned a value that is never used. | | ||
| main.rs:10:9:10:9 | e | Variable is assigned a value that is never used. | | ||
| main.rs:11:9:11:9 | f | Variable is assigned a value that is never used. | | ||
| main.rs:35:5:35:5 | b | Variable is assigned a value that is never used. | | ||
| main.rs:37:5:37:5 | c | Variable is assigned a value that is never used. | | ||
| main.rs:38:5:38:5 | c | Variable is assigned a value that is never used. | | ||
| main.rs:40:5:40:5 | c | Variable is assigned a value that is never used. | | ||
| main.rs:42:5:42:5 | d | Variable is assigned a value that is never used. | | ||
| main.rs:44:9:44:9 | d | Variable is assigned a value that is never used. | | ||
| main.rs:45:9:45:9 | d | Variable is assigned a value that is never used. | | ||
| main.rs:50:5:50:5 | e | Variable is assigned a value that is never used. | | ||
| main.rs:52:9:52:9 | e | Variable is assigned a value that is never used. | | ||
| main.rs:54:9:54:9 | e | Variable is assigned a value that is never used. | | ||
| main.rs:61:5:61:5 | f | Variable is assigned a value that is never used. | | ||
| main.rs:63:5:63:5 | f | Variable is assigned a value that is never used. | | ||
| main.rs:65:5:65:5 | g | Variable is assigned a value that is never used. | | ||
| main.rs:67:5:67:5 | i | Variable is assigned a value that is never used. | | ||
| main.rs:87:9:87:9 | a | Variable is assigned a value that is never used. | | ||
| main.rs:88:9:88:9 | b | Variable is assigned a value that is never used. | | ||
| main.rs:89:9:89:9 | c | Variable is assigned a value that is never used. | | ||
| main.rs:108:9:108:10 | is | Variable is assigned a value that is never used. | | ||
| main.rs:109:9:109:10 | js | Variable is assigned a value that is never used. | | ||
| main.rs:133:13:133:17 | total | Variable is assigned a value that is never used. | | ||
| main.rs:232:13:232:17 | total | Variable is assigned a value that is never used. | | ||
| main.rs:301:9:301:9 | x | Variable is assigned a value that is never used. | | ||
| main.rs:309:17:309:17 | x | Variable is assigned a value that is never used. | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters