diff options
author | Aleksey Kladov <[email protected]> | 2019-11-26 14:12:16 +0000 |
---|---|---|
committer | Aleksey Kladov <[email protected]> | 2019-11-26 14:44:43 +0000 |
commit | 9bc8f1f4f8d7bded19517205f8522a0110204f51 (patch) | |
tree | e3dbb82ff7586c6a26ff08dc69a75fd16c96c115 /crates/ra_hir/src/code_model.rs | |
parent | 4a0792362e2c6cae2809520da454471d5a917384 (diff) |
Store names in TraitData
Diffstat (limited to 'crates/ra_hir/src/code_model.rs')
-rw-r--r-- | crates/ra_hir/src/code_model.rs | 7 |
1 files changed, 2 insertions, 5 deletions
diff --git a/crates/ra_hir/src/code_model.rs b/crates/ra_hir/src/code_model.rs index 9930cff66..9e7a1deec 100644 --- a/crates/ra_hir/src/code_model.rs +++ b/crates/ra_hir/src/code_model.rs | |||
@@ -737,14 +737,11 @@ impl Trait { | |||
737 | } | 737 | } |
738 | 738 | ||
739 | pub fn items(self, db: &impl DefDatabase) -> Vec<AssocItem> { | 739 | pub fn items(self, db: &impl DefDatabase) -> Vec<AssocItem> { |
740 | db.trait_data(self.id).items.iter().map(|it| (*it).into()).collect() | 740 | db.trait_data(self.id).items.iter().map(|(_name, it)| (*it).into()).collect() |
741 | } | 741 | } |
742 | 742 | ||
743 | pub fn associated_type_by_name(self, db: &impl DefDatabase, name: &Name) -> Option<TypeAlias> { | 743 | pub fn associated_type_by_name(self, db: &impl DefDatabase, name: &Name) -> Option<TypeAlias> { |
744 | let trait_data = db.trait_data(self.id); | 744 | db.trait_data(self.id).associated_type_by_name(name).map(TypeAlias::from) |
745 | let res = | ||
746 | trait_data.associated_types().map(TypeAlias::from).find(|t| &t.name(db) == name)?; | ||
747 | Some(res) | ||
748 | } | 745 | } |
749 | 746 | ||
750 | pub fn associated_type_by_name_including_super_traits( | 747 | pub fn associated_type_by_name_including_super_traits( |