mirror of
https://github.com/github/codeql.git
synced 2026-02-11 20:51:06 +01:00
Rust: Apply suggestions from code review
Co-authored-by: Tom Hvitved <hvitved@github.com>
This commit is contained in:
committed by
GitHub
parent
2fa71f0c17
commit
287a8717a8
@@ -21,7 +21,7 @@ final class AssocType extends TypeAlias {
|
||||
|
||||
/** Gets an associated type of `trait` or of a supertrait of `trait`. */
|
||||
AssocType getTraitAssocType(Trait trait) {
|
||||
result = trait.getSupertrait*().getAssocItemList().getAnAssocItem()
|
||||
result.getTrait() = trait.getSupertrait*()
|
||||
}
|
||||
|
||||
/** Holds if `path` is of the form `<type as trait>::name` */
|
||||
@@ -44,7 +44,7 @@ predicate tpAssociatedType(TypeParam tp, AssocType assoc, Path path) {
|
||||
resolvePath(path.getQualifier()) = tp and
|
||||
resolvePath(path) = assoc
|
||||
or
|
||||
exists(TypeRepr typeRepr, Path traitPath, string name |
|
||||
exists(PathTypeRepr typeRepr, Path traitPath, string name |
|
||||
asTraitPath(path, typeRepr, traitPath, name) and
|
||||
tp = resolvePath(typeRepr.(PathTypeRepr).getPath()) and
|
||||
assoc = resolvePath(traitPath).(TraitItemNode).getAssocItem(name)
|
||||
|
||||
@@ -496,7 +496,7 @@ class TypeParamAssociatedTypeTypeParameter extends TypeParameter,
|
||||
AssocType getTypeAlias() { result = assoc }
|
||||
|
||||
/** Gets a path that accesses this type parameter. */
|
||||
Path getPath() { tpAssociatedType(typeParam, assoc, result) }
|
||||
Path getAPath() { tpAssociatedType(typeParam, assoc, result) }
|
||||
|
||||
override ItemNode getDeclaringItem() { result.getTypeParam(_) = typeParam }
|
||||
|
||||
|
||||
@@ -322,7 +322,7 @@ private module MkTypeMention<getAdditionalPathTypeAtSig/2 getAdditionalPathTypeA
|
||||
)
|
||||
or
|
||||
// If this path is a type parameter bound, then any associated types
|
||||
// accessed on the type parameter, that originate from this bound, should
|
||||
// accessed on the type parameter, which originate from this bound, should
|
||||
// be instantiated into the bound, as explained in the comment for
|
||||
// `TypeParamAssociatedTypeTypeParameter`.
|
||||
// ```rust
|
||||
|
||||
Reference in New Issue
Block a user