diff options
author | Lukas Tobias Wirth <[email protected]> | 2021-05-04 21:35:37 +0100 |
---|---|---|
committer | Lukas Tobias Wirth <[email protected]> | 2021-05-04 21:35:37 +0100 |
commit | d26fb188c14e38f5795d1be359defd257c464f37 (patch) | |
tree | 7f73a189da87d7321cadf1ff677c845f5dd81d85 | |
parent | 5b663f1b07233442a3b0b58db453504dcc51ddc9 (diff) |
Add some cov marks for qualified_path completion
-rw-r--r-- | crates/ide_completion/src/completions/qualified_path.rs | 13 |
1 files changed, 8 insertions, 5 deletions
diff --git a/crates/ide_completion/src/completions/qualified_path.rs b/crates/ide_completion/src/completions/qualified_path.rs index d2ebba65f..eedb44873 100644 --- a/crates/ide_completion/src/completions/qualified_path.rs +++ b/crates/ide_completion/src/completions/qualified_path.rs | |||
@@ -59,6 +59,7 @@ pub(crate) fn complete_qualified_path(acc: &mut Completions, ctx: &CompletionCon | |||
59 | hir::ModuleDef::TypeAlias(a) => { | 59 | hir::ModuleDef::TypeAlias(a) => { |
60 | let ty = a.ty(ctx.db); | 60 | let ty = a.ty(ctx.db); |
61 | if let Some(Adt::Enum(e)) = ty.as_adt() { | 61 | if let Some(Adt::Enum(e)) = ty.as_adt() { |
62 | cov_mark::hit!(completes_variant_through_alias); | ||
62 | add_enum_variants(ctx, acc, e); | 63 | add_enum_variants(ctx, acc, e); |
63 | } | 64 | } |
64 | ty | 65 | ty |
@@ -68,6 +69,7 @@ pub(crate) fn complete_qualified_path(acc: &mut Completions, ctx: &CompletionCon | |||
68 | Some(it) => it, | 69 | Some(it) => it, |
69 | None => return, | 70 | None => return, |
70 | }; | 71 | }; |
72 | cov_mark::hit!(completes_primitive_assoc_const); | ||
71 | builtin.ty(ctx.db, module) | 73 | builtin.ty(ctx.db, module) |
72 | } | 74 | } |
73 | _ => unreachable!(), | 75 | _ => unreachable!(), |
@@ -96,9 +98,8 @@ pub(crate) fn complete_qualified_path(acc: &mut Completions, ctx: &CompletionCon | |||
96 | if context_module.map_or(false, |m| !item.is_visible_from(ctx.db, m)) { | 98 | if context_module.map_or(false, |m| !item.is_visible_from(ctx.db, m)) { |
97 | return None; | 99 | return None; |
98 | } | 100 | } |
99 | match item { | 101 | if let hir::AssocItem::TypeAlias(ty) = item { |
100 | hir::AssocItem::Function(_) | hir::AssocItem::Const(_) => {} | 102 | acc.add_type_alias(ctx, ty) |
101 | hir::AssocItem::TypeAlias(ty) => acc.add_type_alias(ctx, ty), | ||
102 | } | 103 | } |
103 | None::<()> | 104 | None::<()> |
104 | }); | 105 | }); |
@@ -745,7 +746,7 @@ fn f() {} | |||
745 | } | 746 | } |
746 | 747 | ||
747 | #[test] | 748 | #[test] |
748 | fn completes_self_enum() { | 749 | fn completes_variant_through_self() { |
749 | check( | 750 | check( |
750 | r#" | 751 | r#" |
751 | enum Foo { | 752 | enum Foo { |
@@ -769,6 +770,7 @@ impl Foo { | |||
769 | 770 | ||
770 | #[test] | 771 | #[test] |
771 | fn completes_primitive_assoc_const() { | 772 | fn completes_primitive_assoc_const() { |
773 | cov_mark::check!(completes_primitive_assoc_const); | ||
772 | check( | 774 | check( |
773 | r#" | 775 | r#" |
774 | //- /lib.rs crate:lib deps:core | 776 | //- /lib.rs crate:lib deps:core |
@@ -792,7 +794,8 @@ impl u8 { | |||
792 | } | 794 | } |
793 | 795 | ||
794 | #[test] | 796 | #[test] |
795 | fn completes_through_alias() { | 797 | fn completes_variant_through_alias() { |
798 | cov_mark::check!(completes_variant_through_alias); | ||
796 | check( | 799 | check( |
797 | r#" | 800 | r#" |
798 | enum Foo { | 801 | enum Foo { |