Skip to content

Commit 7380ec8

Browse files
committed
Address review comments
1 parent 496f485 commit 7380ec8

File tree

1 file changed

+5
-9
lines changed

1 file changed

+5
-9
lines changed

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

Lines changed: 5 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -136,7 +136,7 @@ abstract class ItemNode extends AstNode {
136136
any(TraitItemNode trait |
137137
result = trait.resolveABound().getASuccessorRec(name) and
138138
result instanceof AssocItemNode and
139-
not trait.declares(name)
139+
not trait.hasAssocItem(name)
140140
)
141141
or
142142
// items made available by an implementation where `this` is the implementing type
@@ -152,15 +152,11 @@ abstract class ItemNode extends AstNode {
152152
trait = impl.resolveTraitTy() and
153153
result = trait.getASuccessorRec(name) and
154154
result.(AssocItemNode).hasImplementation() and
155-
not impl.declares(name)
155+
not impl.hasAssocItem(name)
156156
)
157157
or
158158
// type parameters have access to the associated items of its bounds
159-
this =
160-
any(TypeParamItemNode param |
161-
result = param.resolveABound().getASuccessorRec(name) and
162-
result instanceof AssocItemNode
163-
)
159+
result = this.(TypeParamItemNode).resolveABound().getASuccessorRec(name).(AssocItemNode)
164160
}
165161

166162
/** Gets a successor named `name` of this item, if any. */
@@ -282,7 +278,7 @@ class ImplItemNode extends ImplOrTraitItemNode instanceof Impl {
282278

283279
/** Holds if this `impl` block declares an associated item named `name`. */
284280
pragma[nomagic]
285-
predicate declares(string name) {
281+
predicate hasAssocItem(string name) {
286282
name = super.getAssocItemList().getAnAssocItem().(AssocItemNode).getName()
287283
}
288284

@@ -336,7 +332,7 @@ class TraitItemNode extends ImplOrTraitItemNode instanceof Trait {
336332

337333
/** Holds if this trait declares an associated item named `name`. */
338334
pragma[nomagic]
339-
predicate declares(string name) {
335+
predicate hasAssocItem(string name) {
340336
name = super.getAssocItemList().getAnAssocItem().(AssocItemNode).getName()
341337
}
342338

0 commit comments

Comments
 (0)