Improve code

This commit is contained in:
Guillaume Gomez 2021-01-29 14:45:03 +01:00
parent 8e0d1cefd3
commit 076fa63424
2 changed files with 3 additions and 3 deletions

View file

@ -1320,10 +1320,10 @@ impl From<hir::def::DefKind> for TypeKind {
hir::def::DefKind::Union => Self::Union,
hir::def::DefKind::Trait => Self::Trait,
hir::def::DefKind::TyAlias => Self::Typedef,
hir::def::DefKind::ForeignTy => Self::Foreign,
hir::def::DefKind::TraitAlias => Self::TraitAlias,
hir::def::DefKind::Macro(_) => Self::Macro,
hir::def::DefKind::Variant
hir::def::DefKind::ForeignTy
| hir::def::DefKind::Variant
| hir::def::DefKind::AssocTy
| hir::def::DefKind::TyParam
| hir::def::DefKind::ConstParam

View file

@ -304,7 +304,7 @@ crate fn get_real_types<'tcx>(
}
}
if let Some(bound) = generics.params.iter().find(|g| g.is_type() && g.name == arg_s) {
for bound in bound.get_bounds().unwrap_or_else(|| &[]) {
for bound in bound.get_bounds().unwrap_or(&[]) {
if let Some(ty) = bound.get_trait_type() {
let adds = get_real_types(generics, &ty, tcx, recurse + 1, cache, res);
nb_added += adds;