diff options
Diffstat (limited to 'crates/ra_assists/src/handlers')
-rw-r--r-- | crates/ra_assists/src/handlers/auto_import.rs | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/crates/ra_assists/src/handlers/auto_import.rs b/crates/ra_assists/src/handlers/auto_import.rs index 950ec7d05..8d8fe4645 100644 --- a/crates/ra_assists/src/handlers/auto_import.rs +++ b/crates/ra_assists/src/handlers/auto_import.rs | |||
@@ -115,7 +115,7 @@ impl AutoImportAssets { | |||
115 | match &self.import_candidate { | 115 | match &self.import_candidate { |
116 | ImportCandidate::UnqualifiedName(name) => name, | 116 | ImportCandidate::UnqualifiedName(name) => name, |
117 | ImportCandidate::QualifierStart(qualifier_start) => qualifier_start, | 117 | ImportCandidate::QualifierStart(qualifier_start) => qualifier_start, |
118 | ImportCandidate::TraitFunction(_, trait_function_name) => trait_function_name, | 118 | ImportCandidate::TraitAssocItem(_, trait_function_name) => trait_function_name, |
119 | ImportCandidate::TraitMethod(_, trait_method_name) => trait_method_name, | 119 | ImportCandidate::TraitMethod(_, trait_method_name) => trait_method_name, |
120 | } | 120 | } |
121 | } | 121 | } |
@@ -126,8 +126,8 @@ impl AutoImportAssets { | |||
126 | ImportCandidate::QualifierStart(qualifier_start) => { | 126 | ImportCandidate::QualifierStart(qualifier_start) => { |
127 | format!("Import {}", qualifier_start) | 127 | format!("Import {}", qualifier_start) |
128 | } | 128 | } |
129 | ImportCandidate::TraitFunction(_, trait_function_name) => { | 129 | ImportCandidate::TraitAssocItem(_, trait_function_name) => { |
130 | format!("Import a trait for function {}", trait_function_name) | 130 | format!("Import a trait for item {}", trait_function_name) |
131 | } | 131 | } |
132 | ImportCandidate::TraitMethod(_, trait_method_name) => { | 132 | ImportCandidate::TraitMethod(_, trait_method_name) => { |
133 | format!("Import a trait for method {}", trait_method_name) | 133 | format!("Import a trait for method {}", trait_method_name) |
@@ -142,7 +142,7 @@ impl AutoImportAssets { | |||
142 | .find_imports(&self.get_search_query()) | 142 | .find_imports(&self.get_search_query()) |
143 | .into_iter() | 143 | .into_iter() |
144 | .map(|module_def| match &self.import_candidate { | 144 | .map(|module_def| match &self.import_candidate { |
145 | ImportCandidate::TraitFunction(function_callee, _) => { | 145 | ImportCandidate::TraitAssocItem(function_callee, _) => { |
146 | let mut applicable_traits = Vec::new(); | 146 | let mut applicable_traits = Vec::new(); |
147 | if let ModuleDef::Function(located_function) = module_def { | 147 | if let ModuleDef::Function(located_function) = module_def { |
148 | let trait_candidates: FxHashSet<_> = | 148 | let trait_candidates: FxHashSet<_> = |
@@ -255,10 +255,10 @@ enum ImportCandidate { | |||
255 | /// First part of the qualified name. | 255 | /// First part of the qualified name. |
256 | /// For 'std::collections::HashMap', that will be 'std'. | 256 | /// For 'std::collections::HashMap', that will be 'std'. |
257 | QualifierStart(String), | 257 | QualifierStart(String), |
258 | /// A trait function that has no self parameter. | 258 | /// A trait associated function (with no self parameter) or associated constant. |
259 | /// For 'test_mod::TestEnum::test_function', `Type` is the `test_mod::TestEnum` expression type | 259 | /// For 'test_mod::TestEnum::test_function', `Type` is the `test_mod::TestEnum` expression type |
260 | /// and `String`is the `test_function` | 260 | /// and `String` is the `test_function` |
261 | TraitFunction(Type, String), | 261 | TraitAssocItem(Type, String), |
262 | /// A trait method with self parameter. | 262 | /// A trait method with self parameter. |
263 | /// For 'test_enum.test_method()', `Type` is the `test_enum` expression type | 263 | /// For 'test_enum.test_method()', `Type` is the `test_enum` expression type |
264 | /// and `String` is the `test_method` | 264 | /// and `String` is the `test_method` |
@@ -303,7 +303,7 @@ impl ImportCandidate { | |||
303 | source_analyzer.resolve_path(db, &qualifier)? | 303 | source_analyzer.resolve_path(db, &qualifier)? |
304 | }; | 304 | }; |
305 | if let PathResolution::Def(ModuleDef::Adt(function_callee)) = qualifier_resolution { | 305 | if let PathResolution::Def(ModuleDef::Adt(function_callee)) = qualifier_resolution { |
306 | Some(ImportCandidate::TraitFunction( | 306 | Some(ImportCandidate::TraitAssocItem( |
307 | function_callee.ty(db), | 307 | function_callee.ty(db), |
308 | segment.syntax().to_string(), | 308 | segment.syntax().to_string(), |
309 | )) | 309 | )) |