diff options
Diffstat (limited to 'crates/ra_hir')
-rw-r--r-- | crates/ra_hir/src/code_model.rs | 7 | ||||
-rw-r--r-- | crates/ra_hir/src/ty/method_resolution.rs | 6 |
2 files changed, 5 insertions, 8 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( |
diff --git a/crates/ra_hir/src/ty/method_resolution.rs b/crates/ra_hir/src/ty/method_resolution.rs index 0e18684ed..9988570e8 100644 --- a/crates/ra_hir/src/ty/method_resolution.rs +++ b/crates/ra_hir/src/ty/method_resolution.rs | |||
@@ -261,8 +261,8 @@ fn iterate_trait_method_candidates<T>( | |||
261 | // trait, but if we find out it doesn't, we'll skip the rest of the | 261 | // trait, but if we find out it doesn't, we'll skip the rest of the |
262 | // iteration | 262 | // iteration |
263 | let mut known_implemented = false; | 263 | let mut known_implemented = false; |
264 | for &item in data.items.iter() { | 264 | for (_name, item) in data.items.iter() { |
265 | if !is_valid_candidate(db, name, mode, item.into()) { | 265 | if !is_valid_candidate(db, name, mode, (*item).into()) { |
266 | continue; | 266 | continue; |
267 | } | 267 | } |
268 | if !known_implemented { | 268 | if !known_implemented { |
@@ -272,7 +272,7 @@ fn iterate_trait_method_candidates<T>( | |||
272 | } | 272 | } |
273 | } | 273 | } |
274 | known_implemented = true; | 274 | known_implemented = true; |
275 | if let Some(result) = callback(&ty.value, item.into()) { | 275 | if let Some(result) = callback(&ty.value, (*item).into()) { |
276 | return Some(result); | 276 | return Some(result); |
277 | } | 277 | } |
278 | } | 278 | } |