Skip to content

Commit c5f3550

Browse files
committed
Rust: Use hasImplementation in path resolution
1 parent a5dba9b commit c5f3550

File tree

1 file changed

+2
-16
lines changed

1 file changed

+2
-16
lines changed

rust/ql/lib/codeql/rust/internal/PathResolution.qll

Lines changed: 2 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -425,14 +425,7 @@ abstract private class AssocItemNode extends ItemNode, AssocItem {
425425
private class ConstItemNode extends AssocItemNode instanceof Const {
426426
override string getName() { result = Const.super.getName().getText() }
427427

428-
override predicate hasImplementation() {
429-
super.hasBody()
430-
or
431-
// for trait items from library code, we do not currently know if they
432-
// have default implementations or not, so we assume they do
433-
not this.fromSource() and
434-
this = any(TraitItemNode t).getAnAssocItem()
435-
}
428+
override predicate hasImplementation() { Const.super.hasImplementation() }
436429

437430
override Namespace getNamespace() { result.isValue() }
438431

@@ -508,14 +501,7 @@ private class VariantItemNode extends ItemNode instanceof Variant {
508501
class FunctionItemNode extends AssocItemNode instanceof Function {
509502
override string getName() { result = Function.super.getName().getText() }
510503

511-
override predicate hasImplementation() {
512-
super.hasBody()
513-
or
514-
// for trait items from library code, we do not currently know if they
515-
// have default implementations or not, so we assume they do
516-
not this.fromSource() and
517-
this = any(TraitItemNode t).getAnAssocItem()
518-
}
504+
override predicate hasImplementation() { Function.super.hasImplementation() }
519505

520506
override Namespace getNamespace() { result.isValue() }
521507

0 commit comments

Comments
 (0)