Skip to content

Commit

Permalink
Rust: Remove useTreeIsGlobImport workaround
Browse files Browse the repository at this point in the history
  • Loading branch information
hvitved committed Jan 31, 2025
1 parent 9d06f80 commit 1cb524f
Showing 1 changed file with 2 additions and 10 deletions.
12 changes: 2 additions & 10 deletions rust/ql/lib/codeql/rust/elements/internal/PathResolution.qll
Original file line number Diff line number Diff line change
Expand Up @@ -296,16 +296,8 @@ private predicate fileImportEdge(Module mod, string name, ItemNode item) {
)
}

pragma[nomagic]
private predicate useTreeIsGlobImport(UseTree use) {
// TODO: the extractor should provide this information
use.getLocation() != use.getPath().getLocation() and
not use.hasUseTreeList() and
not use.hasRename()
}

private predicate useTreeDeclares(UseTree tree, string name) {
not useTreeIsGlobImport(tree) and
not tree.isGlob() and
not exists(tree.getUseTreeList()) and
(
name = tree.getRename().getName().getText() and
Expand Down Expand Up @@ -455,7 +447,7 @@ private predicate useImportEdge(Use use, string name, ItemNode item) {
exists(UseTree tree, ItemNode used |
used = resolveUseTreeListItem(use, tree) and
not exists(tree.getUseTreeList()) and
if useTreeIsGlobImport(tree)
if tree.isGlob()
then
exists(ItemNode encl |
encl.getADescendant() = use and
Expand Down

0 comments on commit 1cb524f

Please sign in to comment.