Skip to content
This repository was archived by the owner on May 28, 2025. It is now read-only.

Commit 6f006b7

Browse files
committed
Simplify
1 parent 6a8b8a6 commit 6f006b7

File tree

2 files changed

+1
-9
lines changed

2 files changed

+1
-9
lines changed

crates/ide-completion/src/completions/flyimport.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -114,7 +114,6 @@ pub(crate) fn import_on_the_fly(acc: &mut Completions, ctx: &CompletionContext)
114114
|| ctx.is_path_disallowed()
115115
|| ctx.expects_item()
116116
|| ctx.expects_assoc_item()
117-
|| ctx.expects_variant()
118117
{
119118
return None;
120119
}

crates/ide-completion/src/context.rs

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -322,10 +322,6 @@ impl<'a> CompletionContext<'a> {
322322
matches!(self.completion_location, Some(ImmediateLocation::Trait | ImmediateLocation::Impl))
323323
}
324324

325-
pub(crate) fn expects_variant(&self) -> bool {
326-
matches!(self.name_ctx(), Some(NameContext { kind: NameKind::Variant, .. }))
327-
}
328-
329325
pub(crate) fn expects_non_trait_assoc_item(&self) -> bool {
330326
matches!(self.completion_location, Some(ImmediateLocation::Impl))
331327
}
@@ -379,10 +375,7 @@ impl<'a> CompletionContext<'a> {
379375
pub(crate) fn is_path_disallowed(&self) -> bool {
380376
self.previous_token_is(T![unsafe])
381377
|| matches!(self.prev_sibling, Some(ImmediatePrevSibling::Visibility))
382-
|| matches!(
383-
self.name_ctx(),
384-
Some(NameContext { kind: NameKind::Module(_) | NameKind::Rename, .. })
385-
)
378+
|| (matches!(self.name_ctx(), Some(NameContext { .. })) && self.pattern_ctx.is_none())
386379
|| matches!(self.pattern_ctx, Some(PatternContext { record_pat: Some(_), .. }))
387380
|| matches!(
388381
self.nameref_ctx(),

0 commit comments

Comments
 (0)