From 4a0ab832f315344199bd7b7197fc8ae3ca2b7a1c Mon Sep 17 00:00:00 2001 From: Lukas Wirth Date: Mon, 15 Mar 2021 17:23:08 +0100 Subject: unqualfied_path completions aren't responsible for pattern completions --- .../src/completions/unqualified_path.rs | 88 +--------------------- 1 file changed, 1 insertion(+), 87 deletions(-) (limited to 'crates/ide_completion/src/completions/unqualified_path.rs') diff --git a/crates/ide_completion/src/completions/unqualified_path.rs b/crates/ide_completion/src/completions/unqualified_path.rs index 044dfd160..5ef80f6a7 100644 --- a/crates/ide_completion/src/completions/unqualified_path.rs +++ b/crates/ide_completion/src/completions/unqualified_path.rs @@ -6,7 +6,7 @@ use syntax::AstNode; use crate::{CompletionContext, Completions}; pub(crate) fn complete_unqualified_path(acc: &mut Completions, ctx: &CompletionContext) { - if !(ctx.is_trivial_path || ctx.is_pat_binding_or_const) { + if !ctx.is_trivial_path { return; } if ctx.record_lit_syntax.is_some() @@ -23,10 +23,6 @@ pub(crate) fn complete_unqualified_path(acc: &mut Completions, ctx: &CompletionC }); } - if ctx.is_pat_binding_or_const { - return; - } - ctx.scope.process_all_names(&mut |name, res| { if let ScopeDef::GenericParam(hir::GenericParam::LifetimeParam(_)) = res { cov_mark::hit!(skip_lifetime_completion); @@ -608,66 +604,6 @@ fn main() { $0 } ); } - #[test] - fn completes_enum_variant_matcharm() { - check( - r#" -enum Foo { Bar, Baz, Quux } - -fn main() { - let foo = Foo::Quux; - match foo { Qu$0 } -} -"#, - expect![[r#" - ev Foo::Bar () - ev Foo::Baz () - ev Foo::Quux () - en Foo - "#]], - ) - } - - #[test] - fn completes_enum_variant_matcharm_ref() { - check( - r#" -enum Foo { Bar, Baz, Quux } - -fn main() { - let foo = Foo::Quux; - match &foo { Qu$0 } -} -"#, - expect![[r#" - ev Foo::Bar () - ev Foo::Baz () - ev Foo::Quux () - en Foo - "#]], - ) - } - - #[test] - fn completes_enum_variant_iflet() { - check( - r#" -enum Foo { Bar, Baz, Quux } - -fn main() { - let foo = Foo::Quux; - if let Qu$0 = foo { } -} -"#, - expect![[r#" - ev Foo::Bar () - ev Foo::Baz () - ev Foo::Quux () - en Foo - "#]], - ) - } - #[test] fn completes_enum_variant_basic_expr() { check( @@ -700,28 +636,6 @@ fn f() -> m::E { V$0 } ) } - #[test] - fn completes_enum_variant_impl() { - check( - r#" -enum Foo { Bar, Baz, Quux } -impl Foo { - fn foo() { match Foo::Bar { Q$0 } } -} -"#, - expect![[r#" - ev Self::Bar () - ev Self::Baz () - ev Self::Quux () - ev Foo::Bar () - ev Foo::Baz () - ev Foo::Quux () - sp Self - en Foo - "#]], - ) - } - #[test] fn dont_complete_attr() { check( -- cgit v1.2.3