This commit is contained in:
Lukas Wirth 2022-05-24 21:58:47 +02:00
parent 6a8b8a6039
commit 6f006b7524
2 changed files with 1 additions and 9 deletions

View file

@ -114,7 +114,6 @@ pub(crate) fn import_on_the_fly(acc: &mut Completions, ctx: &CompletionContext)
|| ctx.is_path_disallowed() || ctx.is_path_disallowed()
|| ctx.expects_item() || ctx.expects_item()
|| ctx.expects_assoc_item() || ctx.expects_assoc_item()
|| ctx.expects_variant()
{ {
return None; return None;
} }

View file

@ -322,10 +322,6 @@ impl<'a> CompletionContext<'a> {
matches!(self.completion_location, Some(ImmediateLocation::Trait | ImmediateLocation::Impl)) 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 { pub(crate) fn expects_non_trait_assoc_item(&self) -> bool {
matches!(self.completion_location, Some(ImmediateLocation::Impl)) matches!(self.completion_location, Some(ImmediateLocation::Impl))
} }
@ -379,10 +375,7 @@ impl<'a> CompletionContext<'a> {
pub(crate) fn is_path_disallowed(&self) -> bool { pub(crate) fn is_path_disallowed(&self) -> bool {
self.previous_token_is(T![unsafe]) self.previous_token_is(T![unsafe])
|| matches!(self.prev_sibling, Some(ImmediatePrevSibling::Visibility)) || matches!(self.prev_sibling, Some(ImmediatePrevSibling::Visibility))
|| matches!( || (matches!(self.name_ctx(), Some(NameContext { .. })) && self.pattern_ctx.is_none())
self.name_ctx(),
Some(NameContext { kind: NameKind::Module(_) | NameKind::Rename, .. })
)
|| matches!(self.pattern_ctx, Some(PatternContext { record_pat: Some(_), .. })) || matches!(self.pattern_ctx, Some(PatternContext { record_pat: Some(_), .. }))
|| matches!( || matches!(
self.nameref_ctx(), self.nameref_ctx(),