diff options
Diffstat (limited to 'crates/ide_completion/src/completions/flyimport.rs')
-rw-r--r-- | crates/ide_completion/src/completions/flyimport.rs | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/crates/ide_completion/src/completions/flyimport.rs b/crates/ide_completion/src/completions/flyimport.rs index df27e7a84..d72bf13d3 100644 --- a/crates/ide_completion/src/completions/flyimport.rs +++ b/crates/ide_completion/src/completions/flyimport.rs | |||
@@ -162,19 +162,19 @@ pub(crate) fn position_for_import<'a>( | |||
162 | Some(match import_candidate { | 162 | Some(match import_candidate { |
163 | Some(ImportCandidate::Path(_)) => ctx.name_ref_syntax.as_ref()?.syntax(), | 163 | Some(ImportCandidate::Path(_)) => ctx.name_ref_syntax.as_ref()?.syntax(), |
164 | Some(ImportCandidate::TraitAssocItem(_)) => ctx.path_qual.as_ref()?.syntax(), | 164 | Some(ImportCandidate::TraitAssocItem(_)) => ctx.path_qual.as_ref()?.syntax(), |
165 | Some(ImportCandidate::TraitMethod(_)) => ctx.dot_receiver.as_ref()?.syntax(), | 165 | Some(ImportCandidate::TraitMethod(_)) => ctx.dot_receiver()?.syntax(), |
166 | None => ctx | 166 | None => ctx |
167 | .name_ref_syntax | 167 | .name_ref_syntax |
168 | .as_ref() | 168 | .as_ref() |
169 | .map(|name_ref| name_ref.syntax()) | 169 | .map(|name_ref| name_ref.syntax()) |
170 | .or_else(|| ctx.path_qual.as_ref().map(|path| path.syntax())) | 170 | .or_else(|| ctx.path_qual.as_ref().map(|path| path.syntax())) |
171 | .or_else(|| ctx.dot_receiver.as_ref().map(|expr| expr.syntax()))?, | 171 | .or_else(|| ctx.dot_receiver().map(|expr| expr.syntax()))?, |
172 | }) | 172 | }) |
173 | } | 173 | } |
174 | 174 | ||
175 | fn import_assets(ctx: &CompletionContext, fuzzy_name: String) -> Option<ImportAssets> { | 175 | fn import_assets(ctx: &CompletionContext, fuzzy_name: String) -> Option<ImportAssets> { |
176 | let current_module = ctx.scope.module()?; | 176 | let current_module = ctx.scope.module()?; |
177 | if let Some(dot_receiver) = &ctx.dot_receiver { | 177 | if let Some(dot_receiver) = ctx.dot_receiver() { |
178 | ImportAssets::for_fuzzy_method_call( | 178 | ImportAssets::for_fuzzy_method_call( |
179 | current_module, | 179 | current_module, |
180 | ctx.sema.type_of_expr(dot_receiver)?, | 180 | ctx.sema.type_of_expr(dot_receiver)?, |