Skip to content

Commit 287a871

Browse files
paldepindhvitved
andauthored
Rust: Apply suggestions from code review
Co-authored-by: Tom Hvitved <hvitved@github.com>
1 parent 2fa71f0 commit 287a871

File tree

3 files changed

+4
-4
lines changed

3 files changed

+4
-4
lines changed

rust/ql/lib/codeql/rust/internal/typeinference/AssociatedTypes.qll

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ final class AssocType extends TypeAlias {
2121

2222
/** Gets an associated type of `trait` or of a supertrait of `trait`. */
2323
AssocType getTraitAssocType(Trait trait) {
24-
result = trait.getSupertrait*().getAssocItemList().getAnAssocItem()
24+
result.getTrait() = trait.getSupertrait*()
2525
}
2626

2727
/** Holds if `path` is of the form `<type as trait>::name` */
@@ -44,7 +44,7 @@ predicate tpAssociatedType(TypeParam tp, AssocType assoc, Path path) {
4444
resolvePath(path.getQualifier()) = tp and
4545
resolvePath(path) = assoc
4646
or
47-
exists(TypeRepr typeRepr, Path traitPath, string name |
47+
exists(PathTypeRepr typeRepr, Path traitPath, string name |
4848
asTraitPath(path, typeRepr, traitPath, name) and
4949
tp = resolvePath(typeRepr.(PathTypeRepr).getPath()) and
5050
assoc = resolvePath(traitPath).(TraitItemNode).getAssocItem(name)

rust/ql/lib/codeql/rust/internal/typeinference/Type.qll

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -496,7 +496,7 @@ class TypeParamAssociatedTypeTypeParameter extends TypeParameter,
496496
AssocType getTypeAlias() { result = assoc }
497497

498498
/** Gets a path that accesses this type parameter. */
499-
Path getPath() { tpAssociatedType(typeParam, assoc, result) }
499+
Path getAPath() { tpAssociatedType(typeParam, assoc, result) }
500500

501501
override ItemNode getDeclaringItem() { result.getTypeParam(_) = typeParam }
502502

rust/ql/lib/codeql/rust/internal/typeinference/TypeMention.qll

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -322,7 +322,7 @@ private module MkTypeMention<getAdditionalPathTypeAtSig/2 getAdditionalPathTypeA
322322
)
323323
or
324324
// If this path is a type parameter bound, then any associated types
325-
// accessed on the type parameter, that originate from this bound, should
325+
// accessed on the type parameter, which originate from this bound, should
326326
// be instantiated into the bound, as explained in the comment for
327327
// `TypeParamAssociatedTypeTypeParameter`.
328328
// ```rust

0 commit comments

Comments
 (0)