From fc9eed4836dfc88fe2893c81b015ab440cea2ba6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lauren=C8=9Biu=20Nicola?= Date: Mon, 8 Mar 2021 22:19:44 +0200 Subject: Use upstream cov-mark --- crates/ide_completion/src/render/builder_ext.rs | 9 ++++----- crates/ide_completion/src/render/enum_variant.rs | 7 ++----- crates/ide_completion/src/render/function.rs | 11 ++++------- crates/ide_completion/src/render/macro_.rs | 7 ++----- 4 files changed, 12 insertions(+), 22 deletions(-) (limited to 'crates/ide_completion/src/render') diff --git a/crates/ide_completion/src/render/builder_ext.rs b/crates/ide_completion/src/render/builder_ext.rs index d053a988b..95a7596c1 100644 --- a/crates/ide_completion/src/render/builder_ext.rs +++ b/crates/ide_completion/src/render/builder_ext.rs @@ -1,7 +1,6 @@ //! Extensions for `Builder` structure required for item rendering. use itertools::Itertools; -use test_utils::mark; use crate::{item::Builder, CompletionContext}; @@ -30,7 +29,7 @@ impl Builder { return false; } if ctx.use_item_syntax.is_some() { - mark::hit!(no_parens_in_use_item); + cov_mark::hit!(no_parens_in_use_item); return false; } if ctx.is_pattern_call { @@ -43,7 +42,7 @@ impl Builder { // Don't add parentheses if the expected type is some function reference. if let Some(ty) = &ctx.expected_type { if ty.is_fn() { - mark::hit!(no_call_parens_if_fn_ptr_needed); + cov_mark::hit!(no_call_parens_if_fn_ptr_needed); return false; } } @@ -67,7 +66,7 @@ impl Builder { None => return self, }; // If not an import, add parenthesis automatically. - mark::hit!(inserts_parens_for_function_calls); + cov_mark::hit!(inserts_parens_for_function_calls); let (snippet, label) = if params.is_empty() { (format!("{}()$0", name), format!("{}()", name)) @@ -82,7 +81,7 @@ impl Builder { format!("{}({})$0", name, function_params_snippet) } _ => { - mark::hit!(suppress_arg_snippets); + cov_mark::hit!(suppress_arg_snippets); format!("{}($0)", name) } }; diff --git a/crates/ide_completion/src/render/enum_variant.rs b/crates/ide_completion/src/render/enum_variant.rs index 9214193b4..ed055c1fb 100644 --- a/crates/ide_completion/src/render/enum_variant.rs +++ b/crates/ide_completion/src/render/enum_variant.rs @@ -3,7 +3,6 @@ use hir::{HasAttrs, HirDisplay, ModPath, StructKind}; use ide_db::SymbolKind; use itertools::Itertools; -use test_utils::mark; use crate::{ item::{CompletionItem, CompletionKind, ImportEdit}, @@ -68,7 +67,7 @@ impl<'a> EnumRender<'a> { .detail(self.detail()); if self.variant_kind == StructKind::Tuple { - mark::hit!(inserts_parens_for_tuple_enums); + cov_mark::hit!(inserts_parens_for_tuple_enums); let params = Params::Anonymous(self.variant.fields(self.ctx.db()).len()); builder = builder.add_call_parens(self.ctx.completion, self.short_qualified_name, params); @@ -103,13 +102,11 @@ impl<'a> EnumRender<'a> { #[cfg(test)] mod tests { - use test_utils::mark; - use crate::test_utils::check_edit; #[test] fn inserts_parens_for_tuple_enums() { - mark::check!(inserts_parens_for_tuple_enums); + cov_mark::check!(inserts_parens_for_tuple_enums); check_edit( "Some", r#" diff --git a/crates/ide_completion/src/render/function.rs b/crates/ide_completion/src/render/function.rs index e46e21d24..5931945a8 100644 --- a/crates/ide_completion/src/render/function.rs +++ b/crates/ide_completion/src/render/function.rs @@ -3,7 +3,6 @@ use hir::{HasSource, HirDisplay, Type}; use ide_db::SymbolKind; use syntax::ast::Fn; -use test_utils::mark; use crate::{ item::{CompletionItem, CompletionItemKind, CompletionKind, ImportEdit}, @@ -82,7 +81,7 @@ impl<'a> FunctionRender<'a> { self.func.method_params(self.ctx.db()).unwrap_or_default() } else { if let Some(s) = ast_params.self_param() { - mark::hit!(parens_for_method_call_as_assoc_fn); + cov_mark::hit!(parens_for_method_call_as_assoc_fn); params_pats.push(Some(s.to_string())); } self.func.assoc_fn_params(self.ctx.db()) @@ -114,8 +113,6 @@ impl<'a> FunctionRender<'a> { #[cfg(test)] mod tests { - use test_utils::mark; - use crate::{ test_utils::{check_edit, check_edit_with_config, TEST_CONFIG}, CompletionConfig, @@ -123,7 +120,7 @@ mod tests { #[test] fn inserts_parens_for_function_calls() { - mark::check!(inserts_parens_for_function_calls); + cov_mark::check!(inserts_parens_for_function_calls); check_edit( "no_args", r#" @@ -191,7 +188,7 @@ fn bar(s: &S) { #[test] fn parens_for_method_call_as_assoc_fn() { - mark::check!(parens_for_method_call_as_assoc_fn); + cov_mark::check!(parens_for_method_call_as_assoc_fn); check_edit( "foo", r#" @@ -213,7 +210,7 @@ fn main() { S::foo(${1:&self})$0 } #[test] fn suppress_arg_snippets() { - mark::check!(suppress_arg_snippets); + cov_mark::check!(suppress_arg_snippets); check_edit_with_config( CompletionConfig { add_call_argument_snippets: false, ..TEST_CONFIG }, "with_args", diff --git a/crates/ide_completion/src/render/macro_.rs b/crates/ide_completion/src/render/macro_.rs index a4535786f..a6cf3e479 100644 --- a/crates/ide_completion/src/render/macro_.rs +++ b/crates/ide_completion/src/render/macro_.rs @@ -3,7 +3,6 @@ use hir::{Documentation, HasSource}; use ide_db::SymbolKind; use syntax::display::macro_label; -use test_utils::mark; use crate::{ item::{CompletionItem, CompletionKind, ImportEdit}, @@ -57,7 +56,7 @@ impl<'a> MacroRender<'a> { } None if needs_bang => builder.insert_text(self.banged_name()), _ => { - mark::hit!(dont_insert_macro_call_parens_unncessary); + cov_mark::hit!(dont_insert_macro_call_parens_unncessary); builder.insert_text(&self.name) } }; @@ -125,13 +124,11 @@ fn guess_macro_braces(macro_name: &str, docs: &str) -> (&'static str, &'static s #[cfg(test)] mod tests { - use test_utils::mark; - use crate::test_utils::check_edit; #[test] fn dont_insert_macro_call_parens_unncessary() { - mark::check!(dont_insert_macro_call_parens_unncessary); + cov_mark::check!(dont_insert_macro_call_parens_unncessary); check_edit( "frobnicate!", r#" -- cgit v1.2.3