mirror of
https://github.com/rust-lang/rust-analyzer.git
synced 2025-09-26 20:09:19 +00:00
Simplify
This commit is contained in:
parent
6a8b8a6039
commit
6f006b7524
2 changed files with 1 additions and 9 deletions
|
@ -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;
|
||||||
}
|
}
|
||||||
|
|
|
@ -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(),
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue