diff --git a/crates/ide-completion/src/completions/flyimport.rs b/crates/ide-completion/src/completions/flyimport.rs index bbb50cb265..873db300b8 100644 --- a/crates/ide-completion/src/completions/flyimport.rs +++ b/crates/ide-completion/src/completions/flyimport.rs @@ -114,7 +114,6 @@ pub(crate) fn import_on_the_fly(acc: &mut Completions, ctx: &CompletionContext) || ctx.is_path_disallowed() || ctx.expects_item() || ctx.expects_assoc_item() - || ctx.expects_variant() { return None; } diff --git a/crates/ide-completion/src/context.rs b/crates/ide-completion/src/context.rs index 4530d88af8..5e2118ae14 100644 --- a/crates/ide-completion/src/context.rs +++ b/crates/ide-completion/src/context.rs @@ -322,10 +322,6 @@ impl<'a> CompletionContext<'a> { matches!(self.completion_location, Some(ImmediateLocation::Trait | ImmediateLocation::Impl)) } - pub(crate) fn expects_variant(&self) -> bool { - matches!(self.name_ctx(), Some(NameContext { kind: NameKind::Variant, .. })) - } - pub(crate) fn expects_non_trait_assoc_item(&self) -> bool { matches!(self.completion_location, Some(ImmediateLocation::Impl)) } @@ -379,10 +375,7 @@ impl<'a> CompletionContext<'a> { pub(crate) fn is_path_disallowed(&self) -> bool { self.previous_token_is(T![unsafe]) || matches!(self.prev_sibling, Some(ImmediatePrevSibling::Visibility)) - || matches!( - self.name_ctx(), - Some(NameContext { kind: NameKind::Module(_) | NameKind::Rename, .. }) - ) + || (matches!(self.name_ctx(), Some(NameContext { .. })) && self.pattern_ctx.is_none()) || matches!(self.pattern_ctx, Some(PatternContext { record_pat: Some(_), .. })) || matches!( self.nameref_ctx(),