diff options
Diffstat (limited to 'crates/ra_assists')
-rw-r--r-- | crates/ra_assists/src/handlers/auto_import.rs | 27 |
1 files changed, 13 insertions, 14 deletions
diff --git a/crates/ra_assists/src/handlers/auto_import.rs b/crates/ra_assists/src/handlers/auto_import.rs index 86615d659..950ec7d05 100644 --- a/crates/ra_assists/src/handlers/auto_import.rs +++ b/crates/ra_assists/src/handlers/auto_import.rs | |||
@@ -4,8 +4,8 @@ use crate::{ | |||
4 | }; | 4 | }; |
5 | use hir::{ | 5 | use hir::{ |
6 | db::{DefDatabase, HirDatabase}, | 6 | db::{DefDatabase, HirDatabase}, |
7 | AssocContainerId, AssocItem, Crate, Function, ModPath, Module, ModuleDef, PathResolution, | 7 | AsAssocItem, AssocItem, AssocItemContainer, Crate, Function, ModPath, Module, ModuleDef, |
8 | SourceAnalyzer, Trait, Type, | 8 | PathResolution, SourceAnalyzer, Trait, Type, |
9 | }; | 9 | }; |
10 | use ra_ide_db::{imports_locator::ImportsLocator, RootDatabase}; | 10 | use ra_ide_db::{imports_locator::ImportsLocator, RootDatabase}; |
11 | use ra_prof::profile; | 11 | use ra_prof::profile; |
@@ -157,13 +157,12 @@ impl AutoImportAssets { | |||
157 | &trait_candidates, | 157 | &trait_candidates, |
158 | None, | 158 | None, |
159 | |_, assoc| { | 159 | |_, assoc| { |
160 | if let AssocContainerId::TraitId(trait_id) = assoc.container(db) | 160 | if let AssocItemContainer::Trait(appropriate_trait) = |
161 | assoc.container(db) | ||
161 | { | 162 | { |
162 | applicable_traits.push( | 163 | applicable_traits.push( |
163 | self.module_with_name_to_import.find_use_path( | 164 | self.module_with_name_to_import |
164 | db, | 165 | .find_use_path(db, appropriate_trait.into()), |
165 | ModuleDef::Trait(trait_id.into()), | ||
166 | ), | ||
167 | ); | 166 | ); |
168 | }; | 167 | }; |
169 | None::<()> | 168 | None::<()> |
@@ -187,15 +186,15 @@ impl AutoImportAssets { | |||
187 | current_crate, | 186 | current_crate, |
188 | &trait_candidates, | 187 | &trait_candidates, |
189 | None, | 188 | None, |
190 | |_, funciton| { | 189 | |_, function| { |
191 | if let AssocContainerId::TraitId(trait_id) = | 190 | if let AssocItemContainer::Trait(appropriate_trait) = function |
192 | funciton.container(db) | 191 | .as_assoc_item(db) |
192 | .expect("Function is an assoc item") | ||
193 | .container(db) | ||
193 | { | 194 | { |
194 | applicable_traits.push( | 195 | applicable_traits.push( |
195 | self.module_with_name_to_import.find_use_path( | 196 | self.module_with_name_to_import |
196 | db, | 197 | .find_use_path(db, appropriate_trait.into()), |
197 | ModuleDef::Trait(trait_id.into()), | ||
198 | ), | ||
199 | ); | 198 | ); |
200 | }; | 199 | }; |
201 | None::<()> | 200 | None::<()> |