diff options
author | Laurențiu Nicola <[email protected]> | 2021-03-08 20:19:44 +0000 |
---|---|---|
committer | Laurențiu Nicola <[email protected]> | 2021-03-08 20:19:44 +0000 |
commit | fc9eed4836dfc88fe2893c81b015ab440cea2ba6 (patch) | |
tree | 3905029a42c8bb6c5d363753b34cd6b5dd43f4d5 /crates | |
parent | c5189a22ccf4c28e309e4189defbb88b83bb2aea (diff) |
Use upstream cov-mark
Diffstat (limited to 'crates')
99 files changed, 338 insertions, 513 deletions
diff --git a/crates/hir_def/Cargo.toml b/crates/hir_def/Cargo.toml index 535221294..2f07b6d01 100644 --- a/crates/hir_def/Cargo.toml +++ b/crates/hir_def/Cargo.toml | |||
@@ -10,6 +10,7 @@ edition = "2018" | |||
10 | doctest = false | 10 | doctest = false |
11 | 11 | ||
12 | [dependencies] | 12 | [dependencies] |
13 | cov-mark = "1.1" | ||
13 | log = "0.4.8" | 14 | log = "0.4.8" |
14 | once_cell = "1.3.1" | 15 | once_cell = "1.3.1" |
15 | rustc-hash = "1.1.0" | 16 | rustc-hash = "1.1.0" |
diff --git a/crates/hir_def/src/attr.rs b/crates/hir_def/src/attr.rs index 24ffa6c3a..b716d5f6e 100644 --- a/crates/hir_def/src/attr.rs +++ b/crates/hir_def/src/attr.rs | |||
@@ -13,7 +13,6 @@ use syntax::{ | |||
13 | ast::{self, AstNode, AttrsOwner}, | 13 | ast::{self, AstNode, AttrsOwner}, |
14 | match_ast, AstToken, SmolStr, SyntaxNode, | 14 | match_ast, AstToken, SmolStr, SyntaxNode, |
15 | }; | 15 | }; |
16 | use test_utils::mark; | ||
17 | use tt::Subtree; | 16 | use tt::Subtree; |
18 | 17 | ||
19 | use crate::{ | 18 | use crate::{ |
@@ -177,7 +176,7 @@ impl RawAttrs { | |||
177 | if cfg_options.check(&cfg) == Some(false) { | 176 | if cfg_options.check(&cfg) == Some(false) { |
178 | None | 177 | None |
179 | } else { | 178 | } else { |
180 | mark::hit!(cfg_attr_active); | 179 | cov_mark::hit!(cfg_attr_active); |
181 | 180 | ||
182 | let attr = ast::Attr::parse(&format!("#[{}]", attr)).ok()?; | 181 | let attr = ast::Attr::parse(&format!("#[{}]", attr)).ok()?; |
183 | let hygiene = Hygiene::new_unhygienic(); // FIXME | 182 | let hygiene = Hygiene::new_unhygienic(); // FIXME |
diff --git a/crates/hir_def/src/body.rs b/crates/hir_def/src/body.rs index 16e1bac40..b1a3fe1cb 100644 --- a/crates/hir_def/src/body.rs +++ b/crates/hir_def/src/body.rs | |||
@@ -20,7 +20,6 @@ use la_arena::{Arena, ArenaMap}; | |||
20 | use profile::Count; | 20 | use profile::Count; |
21 | use rustc_hash::FxHashMap; | 21 | use rustc_hash::FxHashMap; |
22 | use syntax::{ast, AstNode, AstPtr}; | 22 | use syntax::{ast, AstNode, AstPtr}; |
23 | use test_utils::mark; | ||
24 | 23 | ||
25 | pub(crate) use lower::LowerCtx; | 24 | pub(crate) use lower::LowerCtx; |
26 | 25 | ||
@@ -105,7 +104,7 @@ impl Expander { | |||
105 | macro_call: ast::MacroCall, | 104 | macro_call: ast::MacroCall, |
106 | ) -> ExpandResult<Option<(Mark, T)>> { | 105 | ) -> ExpandResult<Option<(Mark, T)>> { |
107 | if self.recursion_limit + 1 > EXPANSION_RECURSION_LIMIT { | 106 | if self.recursion_limit + 1 > EXPANSION_RECURSION_LIMIT { |
108 | mark::hit!(your_stack_belongs_to_me); | 107 | cov_mark::hit!(your_stack_belongs_to_me); |
109 | return ExpandResult::str_err("reached recursion limit during macro expansion".into()); | 108 | return ExpandResult::str_err("reached recursion limit during macro expansion".into()); |
110 | } | 109 | } |
111 | 110 | ||
diff --git a/crates/hir_def/src/body/lower.rs b/crates/hir_def/src/body/lower.rs index 40beb2f7a..d4abe819d 100644 --- a/crates/hir_def/src/body/lower.rs +++ b/crates/hir_def/src/body/lower.rs | |||
@@ -19,7 +19,6 @@ use syntax::{ | |||
19 | }, | 19 | }, |
20 | AstNode, AstPtr, SyntaxNodePtr, | 20 | AstNode, AstPtr, SyntaxNodePtr, |
21 | }; | 21 | }; |
22 | use test_utils::mark; | ||
23 | 22 | ||
24 | use crate::{ | 23 | use crate::{ |
25 | adt::StructKind, | 24 | adt::StructKind, |
@@ -286,7 +285,7 @@ impl ExprCollector<'_> { | |||
286 | None => self.collect_expr_opt(condition.expr()), | 285 | None => self.collect_expr_opt(condition.expr()), |
287 | // if let -- desugar to match | 286 | // if let -- desugar to match |
288 | Some(pat) => { | 287 | Some(pat) => { |
289 | mark::hit!(infer_resolve_while_let); | 288 | cov_mark::hit!(infer_resolve_while_let); |
290 | let pat = self.collect_pat(pat); | 289 | let pat = self.collect_pat(pat); |
291 | let match_expr = self.collect_expr_opt(condition.expr()); | 290 | let match_expr = self.collect_expr_opt(condition.expr()); |
292 | let placeholder_pat = self.missing_pat(); | 291 | let placeholder_pat = self.missing_pat(); |
diff --git a/crates/hir_def/src/body/scope.rs b/crates/hir_def/src/body/scope.rs index 210b4a617..1bbb54fc6 100644 --- a/crates/hir_def/src/body/scope.rs +++ b/crates/hir_def/src/body/scope.rs | |||
@@ -186,7 +186,7 @@ mod tests { | |||
186 | use base_db::{fixture::WithFixture, FileId, SourceDatabase}; | 186 | use base_db::{fixture::WithFixture, FileId, SourceDatabase}; |
187 | use hir_expand::{name::AsName, InFile}; | 187 | use hir_expand::{name::AsName, InFile}; |
188 | use syntax::{algo::find_node_at_offset, ast, AstNode}; | 188 | use syntax::{algo::find_node_at_offset, ast, AstNode}; |
189 | use test_utils::{assert_eq_text, extract_offset, mark}; | 189 | use test_utils::{assert_eq_text, extract_offset}; |
190 | 190 | ||
191 | use crate::{db::DefDatabase, test_db::TestDB, FunctionId, ModuleDefId}; | 191 | use crate::{db::DefDatabase, test_db::TestDB, FunctionId, ModuleDefId}; |
192 | 192 | ||
@@ -454,7 +454,7 @@ fn foo() { | |||
454 | 454 | ||
455 | #[test] | 455 | #[test] |
456 | fn while_let_desugaring() { | 456 | fn while_let_desugaring() { |
457 | mark::check!(infer_resolve_while_let); | 457 | cov_mark::check!(infer_resolve_while_let); |
458 | do_check_local_name( | 458 | do_check_local_name( |
459 | r#" | 459 | r#" |
460 | fn test() { | 460 | fn test() { |
diff --git a/crates/hir_def/src/body/tests.rs b/crates/hir_def/src/body/tests.rs index bb43569d7..991a32b15 100644 --- a/crates/hir_def/src/body/tests.rs +++ b/crates/hir_def/src/body/tests.rs | |||
@@ -2,7 +2,6 @@ mod block; | |||
2 | 2 | ||
3 | use base_db::{fixture::WithFixture, SourceDatabase}; | 3 | use base_db::{fixture::WithFixture, SourceDatabase}; |
4 | use expect_test::Expect; | 4 | use expect_test::Expect; |
5 | use test_utils::mark; | ||
6 | 5 | ||
7 | use crate::{test_db::TestDB, ModuleDefId}; | 6 | use crate::{test_db::TestDB, ModuleDefId}; |
8 | 7 | ||
@@ -48,7 +47,7 @@ fn check_at(ra_fixture: &str, expect: Expect) { | |||
48 | 47 | ||
49 | #[test] | 48 | #[test] |
50 | fn your_stack_belongs_to_me() { | 49 | fn your_stack_belongs_to_me() { |
51 | mark::check!(your_stack_belongs_to_me); | 50 | cov_mark::check!(your_stack_belongs_to_me); |
52 | lower( | 51 | lower( |
53 | " | 52 | " |
54 | macro_rules! n_nuple { | 53 | macro_rules! n_nuple { |
diff --git a/crates/hir_def/src/body/tests/block.rs b/crates/hir_def/src/body/tests/block.rs index 8bca72a17..3b6ba4cde 100644 --- a/crates/hir_def/src/body/tests/block.rs +++ b/crates/hir_def/src/body/tests/block.rs | |||
@@ -165,16 +165,16 @@ fn macro_resolve() { | |||
165 | check_at( | 165 | check_at( |
166 | r#" | 166 | r#" |
167 | //- /lib.rs crate:lib deps:core | 167 | //- /lib.rs crate:lib deps:core |
168 | use core::mark; | 168 | use core::cov_mark; |
169 | 169 | ||
170 | fn f() { | 170 | fn f() { |
171 | fn nested() { | 171 | fn nested() { |
172 | mark::hit!(Hit); | 172 | cov_mark::hit!(Hit); |
173 | $0 | 173 | $0 |
174 | } | 174 | } |
175 | } | 175 | } |
176 | //- /core.rs crate:core | 176 | //- /core.rs crate:core |
177 | pub mod mark { | 177 | pub mod cov_mark { |
178 | #[macro_export] | 178 | #[macro_export] |
179 | macro_rules! _hit { | 179 | macro_rules! _hit { |
180 | ($name:ident) => { | 180 | ($name:ident) => { |
@@ -193,8 +193,8 @@ pub mod mark { | |||
193 | nested: v | 193 | nested: v |
194 | 194 | ||
195 | crate | 195 | crate |
196 | cov_mark: t | ||
196 | f: v | 197 | f: v |
197 | mark: t | ||
198 | "#]], | 198 | "#]], |
199 | ); | 199 | ); |
200 | } | 200 | } |
@@ -264,7 +264,7 @@ fn main() { | |||
264 | fn underscore_import() { | 264 | fn underscore_import() { |
265 | // This used to panic, because the default (private) visibility inside block expressions would | 265 | // This used to panic, because the default (private) visibility inside block expressions would |
266 | // point into the containing `DefMap`, which visibilities should never be able to do. | 266 | // point into the containing `DefMap`, which visibilities should never be able to do. |
267 | mark::check!(adjust_vis_in_block_def_map); | 267 | cov_mark::check!(adjust_vis_in_block_def_map); |
268 | check_at( | 268 | check_at( |
269 | r#" | 269 | r#" |
270 | mod m { | 270 | mod m { |
diff --git a/crates/hir_def/src/find_path.rs b/crates/hir_def/src/find_path.rs index 3a98ffbaa..de08e2737 100644 --- a/crates/hir_def/src/find_path.rs +++ b/crates/hir_def/src/find_path.rs | |||
@@ -4,7 +4,6 @@ use std::iter; | |||
4 | 4 | ||
5 | use hir_expand::name::{known, AsName, Name}; | 5 | use hir_expand::name::{known, AsName, Name}; |
6 | use rustc_hash::FxHashSet; | 6 | use rustc_hash::FxHashSet; |
7 | use test_utils::mark; | ||
8 | 7 | ||
9 | use crate::nameres::DefMap; | 8 | use crate::nameres::DefMap; |
10 | use crate::{ | 9 | use crate::{ |
@@ -215,7 +214,7 @@ fn find_path_inner( | |||
215 | best_path_len - 1, | 214 | best_path_len - 1, |
216 | prefixed, | 215 | prefixed, |
217 | )?; | 216 | )?; |
218 | mark::hit!(partially_imported); | 217 | cov_mark::hit!(partially_imported); |
219 | path.push_segment(info.path.segments.last().unwrap().clone()); | 218 | path.push_segment(info.path.segments.last().unwrap().clone()); |
220 | Some(path) | 219 | Some(path) |
221 | }) | 220 | }) |
@@ -235,7 +234,7 @@ fn find_path_inner( | |||
235 | // that correctly (FIXME). | 234 | // that correctly (FIXME). |
236 | if let Some(item_module) = item.as_module_def_id().and_then(|did| did.module(db)) { | 235 | if let Some(item_module) = item.as_module_def_id().and_then(|did| did.module(db)) { |
237 | if item_module.def_map(db).block_id().is_some() && prefixed.is_some() { | 236 | if item_module.def_map(db).block_id().is_some() && prefixed.is_some() { |
238 | mark::hit!(prefixed_in_block_expression); | 237 | cov_mark::hit!(prefixed_in_block_expression); |
239 | prefixed = Some(PrefixKind::Plain); | 238 | prefixed = Some(PrefixKind::Plain); |
240 | } | 239 | } |
241 | } | 240 | } |
@@ -252,18 +251,18 @@ fn find_path_inner( | |||
252 | fn select_best_path(old_path: ModPath, new_path: ModPath, prefer_no_std: bool) -> ModPath { | 251 | fn select_best_path(old_path: ModPath, new_path: ModPath, prefer_no_std: bool) -> ModPath { |
253 | if old_path.starts_with_std() && new_path.can_start_with_std() { | 252 | if old_path.starts_with_std() && new_path.can_start_with_std() { |
254 | if prefer_no_std { | 253 | if prefer_no_std { |
255 | mark::hit!(prefer_no_std_paths); | 254 | cov_mark::hit!(prefer_no_std_paths); |
256 | new_path | 255 | new_path |
257 | } else { | 256 | } else { |
258 | mark::hit!(prefer_std_paths); | 257 | cov_mark::hit!(prefer_std_paths); |
259 | old_path | 258 | old_path |
260 | } | 259 | } |
261 | } else if new_path.starts_with_std() && old_path.can_start_with_std() { | 260 | } else if new_path.starts_with_std() && old_path.can_start_with_std() { |
262 | if prefer_no_std { | 261 | if prefer_no_std { |
263 | mark::hit!(prefer_no_std_paths); | 262 | cov_mark::hit!(prefer_no_std_paths); |
264 | old_path | 263 | old_path |
265 | } else { | 264 | } else { |
266 | mark::hit!(prefer_std_paths); | 265 | cov_mark::hit!(prefer_std_paths); |
267 | new_path | 266 | new_path |
268 | } | 267 | } |
269 | } else if new_path.len() < old_path.len() { | 268 | } else if new_path.len() < old_path.len() { |
@@ -364,7 +363,6 @@ mod tests { | |||
364 | use base_db::fixture::WithFixture; | 363 | use base_db::fixture::WithFixture; |
365 | use hir_expand::hygiene::Hygiene; | 364 | use hir_expand::hygiene::Hygiene; |
366 | use syntax::ast::AstNode; | 365 | use syntax::ast::AstNode; |
367 | use test_utils::mark; | ||
368 | 366 | ||
369 | use crate::test_db::TestDB; | 367 | use crate::test_db::TestDB; |
370 | 368 | ||
@@ -522,7 +520,7 @@ mod tests { | |||
522 | 520 | ||
523 | #[test] | 521 | #[test] |
524 | fn partially_imported() { | 522 | fn partially_imported() { |
525 | mark::check!(partially_imported); | 523 | cov_mark::check!(partially_imported); |
526 | // Tests that short paths are used even for external items, when parts of the path are | 524 | // Tests that short paths are used even for external items, when parts of the path are |
527 | // already in scope. | 525 | // already in scope. |
528 | let code = r#" | 526 | let code = r#" |
@@ -686,7 +684,7 @@ mod tests { | |||
686 | 684 | ||
687 | #[test] | 685 | #[test] |
688 | fn prefer_std_paths_over_alloc() { | 686 | fn prefer_std_paths_over_alloc() { |
689 | mark::check!(prefer_std_paths); | 687 | cov_mark::check!(prefer_std_paths); |
690 | let code = r#" | 688 | let code = r#" |
691 | //- /main.rs crate:main deps:alloc,std | 689 | //- /main.rs crate:main deps:alloc,std |
692 | $0 | 690 | $0 |
@@ -712,7 +710,7 @@ mod tests { | |||
712 | 710 | ||
713 | #[test] | 711 | #[test] |
714 | fn prefer_core_paths_over_std() { | 712 | fn prefer_core_paths_over_std() { |
715 | mark::check!(prefer_no_std_paths); | 713 | cov_mark::check!(prefer_no_std_paths); |
716 | let code = r#" | 714 | let code = r#" |
717 | //- /main.rs crate:main deps:core,std | 715 | //- /main.rs crate:main deps:core,std |
718 | #![no_std] | 716 | #![no_std] |
@@ -842,7 +840,7 @@ mod tests { | |||
842 | 840 | ||
843 | #[test] | 841 | #[test] |
844 | fn inner_items_from_inner_module() { | 842 | fn inner_items_from_inner_module() { |
845 | mark::check!(prefixed_in_block_expression); | 843 | cov_mark::check!(prefixed_in_block_expression); |
846 | check_found_path( | 844 | check_found_path( |
847 | r#" | 845 | r#" |
848 | fn main() { | 846 | fn main() { |
diff --git a/crates/hir_def/src/import_map.rs b/crates/hir_def/src/import_map.rs index e1c28bc83..369bc3350 100644 --- a/crates/hir_def/src/import_map.rs +++ b/crates/hir_def/src/import_map.rs | |||
@@ -8,7 +8,6 @@ use hir_expand::name::Name; | |||
8 | use indexmap::{map::Entry, IndexMap}; | 8 | use indexmap::{map::Entry, IndexMap}; |
9 | use itertools::Itertools; | 9 | use itertools::Itertools; |
10 | use rustc_hash::{FxHashSet, FxHasher}; | 10 | use rustc_hash::{FxHashSet, FxHasher}; |
11 | use test_utils::mark; | ||
12 | 11 | ||
13 | use crate::{ | 12 | use crate::{ |
14 | db::DefDatabase, item_scope::ItemInNs, visibility::Visibility, AssocItemId, ModuleDefId, | 13 | db::DefDatabase, item_scope::ItemInNs, visibility::Visibility, AssocItemId, ModuleDefId, |
@@ -193,7 +192,7 @@ impl ImportMap { | |||
193 | // cannot use associated type aliases directly: need a `<Struct as Trait>::TypeAlias` | 192 | // cannot use associated type aliases directly: need a `<Struct as Trait>::TypeAlias` |
194 | // qualifier, ergo no need to store it for imports in import_map | 193 | // qualifier, ergo no need to store it for imports in import_map |
195 | AssocItemId::TypeAliasId(_) => { | 194 | AssocItemId::TypeAliasId(_) => { |
196 | mark::hit!(type_aliases_ignored); | 195 | cov_mark::hit!(type_aliases_ignored); |
197 | continue; | 196 | continue; |
198 | } | 197 | } |
199 | }; | 198 | }; |
@@ -463,7 +462,6 @@ fn item_import_kind(item: ItemInNs) -> Option<ImportKind> { | |||
463 | mod tests { | 462 | mod tests { |
464 | use base_db::{fixture::WithFixture, SourceDatabase, Upcast}; | 463 | use base_db::{fixture::WithFixture, SourceDatabase, Upcast}; |
465 | use expect_test::{expect, Expect}; | 464 | use expect_test::{expect, Expect}; |
466 | use test_utils::mark; | ||
467 | 465 | ||
468 | use crate::{test_db::TestDB, AssocContainerId, Lookup}; | 466 | use crate::{test_db::TestDB, AssocContainerId, Lookup}; |
469 | 467 | ||
@@ -801,7 +799,7 @@ mod tests { | |||
801 | 799 | ||
802 | #[test] | 800 | #[test] |
803 | fn fuzzy_import_trait_and_assoc_items() { | 801 | fn fuzzy_import_trait_and_assoc_items() { |
804 | mark::check!(type_aliases_ignored); | 802 | cov_mark::check!(type_aliases_ignored); |
805 | let ra_fixture = r#" | 803 | let ra_fixture = r#" |
806 | //- /main.rs crate:main deps:dep | 804 | //- /main.rs crate:main deps:dep |
807 | //- /dep.rs crate:dep | 805 | //- /dep.rs crate:dep |
diff --git a/crates/hir_def/src/item_scope.rs b/crates/hir_def/src/item_scope.rs index 4e5daa2ff..919933813 100644 --- a/crates/hir_def/src/item_scope.rs +++ b/crates/hir_def/src/item_scope.rs | |||
@@ -9,7 +9,6 @@ use hir_expand::MacroDefKind; | |||
9 | use once_cell::sync::Lazy; | 9 | use once_cell::sync::Lazy; |
10 | use rustc_hash::{FxHashMap, FxHashSet}; | 10 | use rustc_hash::{FxHashMap, FxHashSet}; |
11 | use stdx::format_to; | 11 | use stdx::format_to; |
12 | use test_utils::mark; | ||
13 | 12 | ||
14 | use crate::{ | 13 | use crate::{ |
15 | db::DefDatabase, per_ns::PerNs, visibility::Visibility, AdtId, BuiltinType, ImplId, | 14 | db::DefDatabase, per_ns::PerNs, visibility::Visibility, AdtId, BuiltinType, ImplId, |
@@ -237,7 +236,7 @@ impl ItemScope { | |||
237 | if $glob_imports.$field.contains(&$lookup) | 236 | if $glob_imports.$field.contains(&$lookup) |
238 | && matches!($def_import_type, ImportType::Named) => | 237 | && matches!($def_import_type, ImportType::Named) => |
239 | { | 238 | { |
240 | mark::hit!(import_shadowed); | 239 | cov_mark::hit!(import_shadowed); |
241 | $glob_imports.$field.remove(&$lookup); | 240 | $glob_imports.$field.remove(&$lookup); |
242 | if let Some(fld) = $def.$field { | 241 | if let Some(fld) = $def.$field { |
243 | entry.insert(fld); | 242 | entry.insert(fld); |
diff --git a/crates/hir_def/src/item_tree.rs b/crates/hir_def/src/item_tree.rs index 3233b1957..6bb334573 100644 --- a/crates/hir_def/src/item_tree.rs +++ b/crates/hir_def/src/item_tree.rs | |||
@@ -25,7 +25,6 @@ use profile::Count; | |||
25 | use rustc_hash::FxHashMap; | 25 | use rustc_hash::FxHashMap; |
26 | use smallvec::SmallVec; | 26 | use smallvec::SmallVec; |
27 | use syntax::{ast, match_ast, SyntaxKind}; | 27 | use syntax::{ast, match_ast, SyntaxKind}; |
28 | use test_utils::mark; | ||
29 | 28 | ||
30 | use crate::{ | 29 | use crate::{ |
31 | attr::{Attrs, RawAttrs}, | 30 | attr::{Attrs, RawAttrs}, |
diff --git a/crates/hir_def/src/item_tree/lower.rs b/crates/hir_def/src/item_tree/lower.rs index 8f2f0b340..240fdacf9 100644 --- a/crates/hir_def/src/item_tree/lower.rs +++ b/crates/hir_def/src/item_tree/lower.rs | |||
@@ -466,7 +466,7 @@ impl Ctx { | |||
466 | .collect() | 466 | .collect() |
467 | }) | 467 | }) |
468 | .unwrap_or_else(|| { | 468 | .unwrap_or_else(|| { |
469 | mark::hit!(name_res_works_for_broken_modules); | 469 | cov_mark::hit!(name_res_works_for_broken_modules); |
470 | Box::new([]) as Box<[_]> | 470 | Box::new([]) as Box<[_]> |
471 | }), | 471 | }), |
472 | } | 472 | } |
diff --git a/crates/hir_def/src/nameres/collector.rs b/crates/hir_def/src/nameres/collector.rs index e51d89b43..3bb69d935 100644 --- a/crates/hir_def/src/nameres/collector.rs +++ b/crates/hir_def/src/nameres/collector.rs | |||
@@ -18,7 +18,6 @@ use hir_expand::{ | |||
18 | use hir_expand::{InFile, MacroCallLoc}; | 18 | use hir_expand::{InFile, MacroCallLoc}; |
19 | use rustc_hash::{FxHashMap, FxHashSet}; | 19 | use rustc_hash::{FxHashMap, FxHashSet}; |
20 | use syntax::ast; | 20 | use syntax::ast; |
21 | use test_utils::mark; | ||
22 | use tt::{Leaf, TokenTree}; | 21 | use tt::{Leaf, TokenTree}; |
23 | 22 | ||
24 | use crate::{ | 23 | use crate::{ |
@@ -462,7 +461,7 @@ impl DefCollector<'_> { | |||
462 | let res = self.def_map.resolve_name_in_extern_prelude(&extern_crate.name); | 461 | let res = self.def_map.resolve_name_in_extern_prelude(&extern_crate.name); |
463 | 462 | ||
464 | if let Some(ModuleDefId::ModuleId(m)) = res.take_types() { | 463 | if let Some(ModuleDefId::ModuleId(m)) = res.take_types() { |
465 | mark::hit!(macro_rules_from_other_crates_are_visible_with_macro_use); | 464 | cov_mark::hit!(macro_rules_from_other_crates_are_visible_with_macro_use); |
466 | self.import_all_macros_exported(current_module_id, m.krate); | 465 | self.import_all_macros_exported(current_module_id, m.krate); |
467 | } | 466 | } |
468 | } | 467 | } |
@@ -571,10 +570,10 @@ impl DefCollector<'_> { | |||
571 | match def.take_types() { | 570 | match def.take_types() { |
572 | Some(ModuleDefId::ModuleId(m)) => { | 571 | Some(ModuleDefId::ModuleId(m)) => { |
573 | if import.is_prelude { | 572 | if import.is_prelude { |
574 | mark::hit!(std_prelude); | 573 | cov_mark::hit!(std_prelude); |
575 | self.def_map.prelude = Some(m); | 574 | self.def_map.prelude = Some(m); |
576 | } else if m.krate != self.def_map.krate { | 575 | } else if m.krate != self.def_map.krate { |
577 | mark::hit!(glob_across_crates); | 576 | cov_mark::hit!(glob_across_crates); |
578 | // glob import from other crate => we can just import everything once | 577 | // glob import from other crate => we can just import everything once |
579 | let item_map = m.def_map(self.db); | 578 | let item_map = m.def_map(self.db); |
580 | let scope = &item_map[m.local_id].scope; | 579 | let scope = &item_map[m.local_id].scope; |
@@ -626,7 +625,7 @@ impl DefCollector<'_> { | |||
626 | } | 625 | } |
627 | } | 626 | } |
628 | Some(ModuleDefId::AdtId(AdtId::EnumId(e))) => { | 627 | Some(ModuleDefId::AdtId(AdtId::EnumId(e))) => { |
629 | mark::hit!(glob_enum); | 628 | cov_mark::hit!(glob_enum); |
630 | // glob import from enum => just import all the variants | 629 | // glob import from enum => just import all the variants |
631 | 630 | ||
632 | // XXX: urgh, so this works by accident! Here, we look at | 631 | // XXX: urgh, so this works by accident! Here, we look at |
@@ -675,7 +674,7 @@ impl DefCollector<'_> { | |||
675 | 674 | ||
676 | self.update(module_id, &[(name, def)], vis, ImportType::Named); | 675 | self.update(module_id, &[(name, def)], vis, ImportType::Named); |
677 | } | 676 | } |
678 | None => mark::hit!(bogus_paths), | 677 | None => cov_mark::hit!(bogus_paths), |
679 | } | 678 | } |
680 | } | 679 | } |
681 | } | 680 | } |
@@ -738,7 +737,7 @@ impl DefCollector<'_> { | |||
738 | if max_vis == old_vis { | 737 | if max_vis == old_vis { |
739 | false | 738 | false |
740 | } else { | 739 | } else { |
741 | mark::hit!(upgrade_underscore_visibility); | 740 | cov_mark::hit!(upgrade_underscore_visibility); |
742 | true | 741 | true |
743 | } | 742 | } |
744 | } | 743 | } |
@@ -866,7 +865,7 @@ impl DefCollector<'_> { | |||
866 | depth: usize, | 865 | depth: usize, |
867 | ) { | 866 | ) { |
868 | if depth > EXPANSION_DEPTH_LIMIT { | 867 | if depth > EXPANSION_DEPTH_LIMIT { |
869 | mark::hit!(macro_expansion_overflow); | 868 | cov_mark::hit!(macro_expansion_overflow); |
870 | log::warn!("macro expansion is too deep"); | 869 | log::warn!("macro expansion is too deep"); |
871 | return; | 870 | return; |
872 | } | 871 | } |
@@ -1009,7 +1008,7 @@ impl ModCollector<'_, '_> { | |||
1009 | // Prelude module is always considered to be `#[macro_use]`. | 1008 | // Prelude module is always considered to be `#[macro_use]`. |
1010 | if let Some(prelude_module) = self.def_collector.def_map.prelude { | 1009 | if let Some(prelude_module) = self.def_collector.def_map.prelude { |
1011 | if prelude_module.krate != self.def_collector.def_map.krate { | 1010 | if prelude_module.krate != self.def_collector.def_map.krate { |
1012 | mark::hit!(prelude_is_macro_use); | 1011 | cov_mark::hit!(prelude_is_macro_use); |
1013 | self.def_collector.import_all_macros_exported(self.module_id, prelude_module.krate); | 1012 | self.def_collector.import_all_macros_exported(self.module_id, prelude_module.krate); |
1014 | } | 1013 | } |
1015 | } | 1014 | } |
diff --git a/crates/hir_def/src/nameres/mod_resolution.rs b/crates/hir_def/src/nameres/mod_resolution.rs index af3262439..d5de9899c 100644 --- a/crates/hir_def/src/nameres/mod_resolution.rs +++ b/crates/hir_def/src/nameres/mod_resolution.rs | |||
@@ -2,7 +2,6 @@ | |||
2 | use base_db::{AnchoredPath, FileId}; | 2 | use base_db::{AnchoredPath, FileId}; |
3 | use hir_expand::name::Name; | 3 | use hir_expand::name::Name; |
4 | use syntax::SmolStr; | 4 | use syntax::SmolStr; |
5 | use test_utils::mark; | ||
6 | 5 | ||
7 | use crate::{db::DefDatabase, HirFileId}; | 6 | use crate::{db::DefDatabase, HirFileId}; |
8 | 7 | ||
@@ -28,7 +27,7 @@ impl ModDir { | |||
28 | let depth = self.depth + 1; | 27 | let depth = self.depth + 1; |
29 | if depth > MOD_DEPTH_LIMIT { | 28 | if depth > MOD_DEPTH_LIMIT { |
30 | log::error!("MOD_DEPTH_LIMIT exceeded"); | 29 | log::error!("MOD_DEPTH_LIMIT exceeded"); |
31 | mark::hit!(circular_mods); | 30 | cov_mark::hit!(circular_mods); |
32 | return None; | 31 | return None; |
33 | } | 32 | } |
34 | Some(ModDir { dir_path, root_non_dir_owner, depth }) | 33 | Some(ModDir { dir_path, root_non_dir_owner, depth }) |
diff --git a/crates/hir_def/src/nameres/path_resolution.rs b/crates/hir_def/src/nameres/path_resolution.rs index dd1db0094..8258dcffb 100644 --- a/crates/hir_def/src/nameres/path_resolution.rs +++ b/crates/hir_def/src/nameres/path_resolution.rs | |||
@@ -13,7 +13,6 @@ | |||
13 | use base_db::Edition; | 13 | use base_db::Edition; |
14 | use hir_expand::name; | 14 | use hir_expand::name; |
15 | use hir_expand::name::Name; | 15 | use hir_expand::name::Name; |
16 | use test_utils::mark; | ||
17 | 16 | ||
18 | use crate::{ | 17 | use crate::{ |
19 | db::DefDatabase, | 18 | db::DefDatabase, |
@@ -63,7 +62,7 @@ impl ResolvePathResult { | |||
63 | impl DefMap { | 62 | impl DefMap { |
64 | pub(super) fn resolve_name_in_extern_prelude(&self, name: &Name) -> PerNs { | 63 | pub(super) fn resolve_name_in_extern_prelude(&self, name: &Name) -> PerNs { |
65 | if name == &name!(self) { | 64 | if name == &name!(self) { |
66 | mark::hit!(extern_crate_self_as); | 65 | cov_mark::hit!(extern_crate_self_as); |
67 | return PerNs::types(self.module_id(self.root).into(), Visibility::Public); | 66 | return PerNs::types(self.module_id(self.root).into(), Visibility::Public); |
68 | } | 67 | } |
69 | self.extern_prelude | 68 | self.extern_prelude |
@@ -101,7 +100,7 @@ impl DefMap { | |||
101 | // DefMap they're written in, so we restrict them when that happens. | 100 | // DefMap they're written in, so we restrict them when that happens. |
102 | if let Visibility::Module(m) = vis { | 101 | if let Visibility::Module(m) = vis { |
103 | if self.block_id() != m.block { | 102 | if self.block_id() != m.block { |
104 | mark::hit!(adjust_vis_in_block_def_map); | 103 | cov_mark::hit!(adjust_vis_in_block_def_map); |
105 | vis = Visibility::Module(self.module_id(self.root())); | 104 | vis = Visibility::Module(self.module_id(self.root())); |
106 | log::debug!("visibility {:?} points outside DefMap, adjusting to {:?}", m, vis); | 105 | log::debug!("visibility {:?} points outside DefMap, adjusting to {:?}", m, vis); |
107 | } | 106 | } |
@@ -169,12 +168,12 @@ impl DefMap { | |||
169 | let mut curr_per_ns: PerNs = match path.kind { | 168 | let mut curr_per_ns: PerNs = match path.kind { |
170 | PathKind::DollarCrate(krate) => { | 169 | PathKind::DollarCrate(krate) => { |
171 | if krate == self.krate { | 170 | if krate == self.krate { |
172 | mark::hit!(macro_dollar_crate_self); | 171 | cov_mark::hit!(macro_dollar_crate_self); |
173 | PerNs::types(self.crate_root(db).into(), Visibility::Public) | 172 | PerNs::types(self.crate_root(db).into(), Visibility::Public) |
174 | } else { | 173 | } else { |
175 | let def_map = db.crate_def_map(krate); | 174 | let def_map = db.crate_def_map(krate); |
176 | let module = def_map.module_id(def_map.root); | 175 | let module = def_map.module_id(def_map.root); |
177 | mark::hit!(macro_dollar_crate_other); | 176 | cov_mark::hit!(macro_dollar_crate_other); |
178 | PerNs::types(module.into(), Visibility::Public) | 177 | PerNs::types(module.into(), Visibility::Public) |
179 | } | 178 | } |
180 | } | 179 | } |
@@ -310,7 +309,7 @@ impl DefMap { | |||
310 | } | 309 | } |
311 | ModuleDefId::AdtId(AdtId::EnumId(e)) => { | 310 | ModuleDefId::AdtId(AdtId::EnumId(e)) => { |
312 | // enum variant | 311 | // enum variant |
313 | mark::hit!(can_import_enum_variant); | 312 | cov_mark::hit!(can_import_enum_variant); |
314 | let enum_data = db.enum_data(e); | 313 | let enum_data = db.enum_data(e); |
315 | match enum_data.variant(&segment) { | 314 | match enum_data.variant(&segment) { |
316 | Some(local_id) => { | 315 | Some(local_id) => { |
diff --git a/crates/hir_def/src/nameres/tests.rs b/crates/hir_def/src/nameres/tests.rs index bd3e2701b..de3aa4f9a 100644 --- a/crates/hir_def/src/nameres/tests.rs +++ b/crates/hir_def/src/nameres/tests.rs | |||
@@ -9,7 +9,6 @@ use std::sync::Arc; | |||
9 | 9 | ||
10 | use base_db::{fixture::WithFixture, SourceDatabase}; | 10 | use base_db::{fixture::WithFixture, SourceDatabase}; |
11 | use expect_test::{expect, Expect}; | 11 | use expect_test::{expect, Expect}; |
12 | use test_utils::mark; | ||
13 | 12 | ||
14 | use crate::{db::DefDatabase, test_db::TestDB}; | 13 | use crate::{db::DefDatabase, test_db::TestDB}; |
15 | 14 | ||
@@ -136,7 +135,7 @@ mod m { | |||
136 | 135 | ||
137 | #[test] | 136 | #[test] |
138 | fn bogus_paths() { | 137 | fn bogus_paths() { |
139 | mark::check!(bogus_paths); | 138 | cov_mark::check!(bogus_paths); |
140 | check( | 139 | check( |
141 | r#" | 140 | r#" |
142 | //- /lib.rs | 141 | //- /lib.rs |
@@ -243,7 +242,7 @@ pub struct Baz; | |||
243 | 242 | ||
244 | #[test] | 243 | #[test] |
245 | fn std_prelude() { | 244 | fn std_prelude() { |
246 | mark::check!(std_prelude); | 245 | cov_mark::check!(std_prelude); |
247 | check( | 246 | check( |
248 | r#" | 247 | r#" |
249 | //- /main.rs crate:main deps:test_crate | 248 | //- /main.rs crate:main deps:test_crate |
@@ -267,7 +266,7 @@ pub enum Foo { Bar, Baz }; | |||
267 | 266 | ||
268 | #[test] | 267 | #[test] |
269 | fn can_import_enum_variant() { | 268 | fn can_import_enum_variant() { |
270 | mark::check!(can_import_enum_variant); | 269 | cov_mark::check!(can_import_enum_variant); |
271 | check( | 270 | check( |
272 | r#" | 271 | r#" |
273 | enum E { V } | 272 | enum E { V } |
@@ -628,7 +627,7 @@ use crate::reex::*; | |||
628 | 627 | ||
629 | #[test] | 628 | #[test] |
630 | fn underscore_pub_crate_reexport() { | 629 | fn underscore_pub_crate_reexport() { |
631 | mark::check!(upgrade_underscore_visibility); | 630 | cov_mark::check!(upgrade_underscore_visibility); |
632 | check( | 631 | check( |
633 | r#" | 632 | r#" |
634 | //- /main.rs crate:main deps:lib | 633 | //- /main.rs crate:main deps:lib |
diff --git a/crates/hir_def/src/nameres/tests/diagnostics.rs b/crates/hir_def/src/nameres/tests/diagnostics.rs index e8e72e5ef..d5ef8ceb5 100644 --- a/crates/hir_def/src/nameres/tests/diagnostics.rs +++ b/crates/hir_def/src/nameres/tests/diagnostics.rs | |||
@@ -1,5 +1,4 @@ | |||
1 | use base_db::fixture::WithFixture; | 1 | use base_db::fixture::WithFixture; |
2 | use test_utils::mark; | ||
3 | 2 | ||
4 | use crate::test_db::TestDB; | 3 | use crate::test_db::TestDB; |
5 | 4 | ||
@@ -63,7 +62,7 @@ fn unresolved_extern_crate() { | |||
63 | 62 | ||
64 | #[test] | 63 | #[test] |
65 | fn extern_crate_self_as() { | 64 | fn extern_crate_self_as() { |
66 | mark::check!(extern_crate_self_as); | 65 | cov_mark::check!(extern_crate_self_as); |
67 | check_diagnostics( | 66 | check_diagnostics( |
68 | r" | 67 | r" |
69 | //- /lib.rs | 68 | //- /lib.rs |
@@ -140,7 +139,7 @@ fn inactive_item() { | |||
140 | /// Tests that `cfg` attributes behind `cfg_attr` is handled properly. | 139 | /// Tests that `cfg` attributes behind `cfg_attr` is handled properly. |
141 | #[test] | 140 | #[test] |
142 | fn inactive_via_cfg_attr() { | 141 | fn inactive_via_cfg_attr() { |
143 | mark::check!(cfg_attr_active); | 142 | cov_mark::check!(cfg_attr_active); |
144 | check_diagnostics( | 143 | check_diagnostics( |
145 | r#" | 144 | r#" |
146 | //- /lib.rs | 145 | //- /lib.rs |
diff --git a/crates/hir_def/src/nameres/tests/globs.rs b/crates/hir_def/src/nameres/tests/globs.rs index 2ae836e3c..17426d54d 100644 --- a/crates/hir_def/src/nameres/tests/globs.rs +++ b/crates/hir_def/src/nameres/tests/globs.rs | |||
@@ -148,7 +148,7 @@ pub(crate) struct PubCrateStruct; | |||
148 | 148 | ||
149 | #[test] | 149 | #[test] |
150 | fn glob_across_crates() { | 150 | fn glob_across_crates() { |
151 | mark::check!(glob_across_crates); | 151 | cov_mark::check!(glob_across_crates); |
152 | check( | 152 | check( |
153 | r#" | 153 | r#" |
154 | //- /main.rs crate:main deps:test_crate | 154 | //- /main.rs crate:main deps:test_crate |
@@ -184,7 +184,7 @@ struct Foo; | |||
184 | 184 | ||
185 | #[test] | 185 | #[test] |
186 | fn glob_enum() { | 186 | fn glob_enum() { |
187 | mark::check!(glob_enum); | 187 | cov_mark::check!(glob_enum); |
188 | check( | 188 | check( |
189 | r#" | 189 | r#" |
190 | enum Foo { Bar, Baz } | 190 | enum Foo { Bar, Baz } |
@@ -201,7 +201,7 @@ use self::Foo::*; | |||
201 | 201 | ||
202 | #[test] | 202 | #[test] |
203 | fn glob_enum_group() { | 203 | fn glob_enum_group() { |
204 | mark::check!(glob_enum_group); | 204 | cov_mark::check!(glob_enum_group); |
205 | check( | 205 | check( |
206 | r#" | 206 | r#" |
207 | enum Foo { Bar, Baz } | 207 | enum Foo { Bar, Baz } |
@@ -218,7 +218,7 @@ use self::Foo::{*}; | |||
218 | 218 | ||
219 | #[test] | 219 | #[test] |
220 | fn glob_shadowed_def() { | 220 | fn glob_shadowed_def() { |
221 | mark::check!(import_shadowed); | 221 | cov_mark::check!(import_shadowed); |
222 | check( | 222 | check( |
223 | r#" | 223 | r#" |
224 | //- /lib.rs | 224 | //- /lib.rs |
diff --git a/crates/hir_def/src/nameres/tests/macros.rs b/crates/hir_def/src/nameres/tests/macros.rs index 36ed5e8ce..f65a655bf 100644 --- a/crates/hir_def/src/nameres/tests/macros.rs +++ b/crates/hir_def/src/nameres/tests/macros.rs | |||
@@ -210,7 +210,7 @@ macro_rules! bar { | |||
210 | 210 | ||
211 | #[test] | 211 | #[test] |
212 | fn macro_rules_from_other_crates_are_visible_with_macro_use() { | 212 | fn macro_rules_from_other_crates_are_visible_with_macro_use() { |
213 | mark::check!(macro_rules_from_other_crates_are_visible_with_macro_use); | 213 | cov_mark::check!(macro_rules_from_other_crates_are_visible_with_macro_use); |
214 | check( | 214 | check( |
215 | r#" | 215 | r#" |
216 | //- /main.rs crate:main deps:foo | 216 | //- /main.rs crate:main deps:foo |
@@ -260,7 +260,7 @@ mod priv_mod { | |||
260 | 260 | ||
261 | #[test] | 261 | #[test] |
262 | fn prelude_is_macro_use() { | 262 | fn prelude_is_macro_use() { |
263 | mark::check!(prelude_is_macro_use); | 263 | cov_mark::check!(prelude_is_macro_use); |
264 | check( | 264 | check( |
265 | r#" | 265 | r#" |
266 | //- /main.rs crate:main deps:foo | 266 | //- /main.rs crate:main deps:foo |
@@ -550,7 +550,7 @@ mod m { | |||
550 | 550 | ||
551 | #[test] | 551 | #[test] |
552 | fn macro_dollar_crate_is_correct_in_item() { | 552 | fn macro_dollar_crate_is_correct_in_item() { |
553 | mark::check!(macro_dollar_crate_self); | 553 | cov_mark::check!(macro_dollar_crate_self); |
554 | check( | 554 | check( |
555 | r#" | 555 | r#" |
556 | //- /main.rs crate:main deps:foo | 556 | //- /main.rs crate:main deps:foo |
@@ -608,7 +608,7 @@ struct Baz; | |||
608 | 608 | ||
609 | #[test] | 609 | #[test] |
610 | fn macro_dollar_crate_is_correct_in_indirect_deps() { | 610 | fn macro_dollar_crate_is_correct_in_indirect_deps() { |
611 | mark::check!(macro_dollar_crate_other); | 611 | cov_mark::check!(macro_dollar_crate_other); |
612 | // From std | 612 | // From std |
613 | check( | 613 | check( |
614 | r#" | 614 | r#" |
@@ -686,7 +686,7 @@ pub trait Clone {} | |||
686 | 686 | ||
687 | #[test] | 687 | #[test] |
688 | fn macro_expansion_overflow() { | 688 | fn macro_expansion_overflow() { |
689 | mark::check!(macro_expansion_overflow); | 689 | cov_mark::check!(macro_expansion_overflow); |
690 | check( | 690 | check( |
691 | r#" | 691 | r#" |
692 | macro_rules! a { | 692 | macro_rules! a { |
diff --git a/crates/hir_def/src/nameres/tests/mod_resolution.rs b/crates/hir_def/src/nameres/tests/mod_resolution.rs index e80b593aa..dfbbad1f9 100644 --- a/crates/hir_def/src/nameres/tests/mod_resolution.rs +++ b/crates/hir_def/src/nameres/tests/mod_resolution.rs | |||
@@ -2,7 +2,7 @@ use super::*; | |||
2 | 2 | ||
3 | #[test] | 3 | #[test] |
4 | fn name_res_works_for_broken_modules() { | 4 | fn name_res_works_for_broken_modules() { |
5 | mark::check!(name_res_works_for_broken_modules); | 5 | cov_mark::check!(name_res_works_for_broken_modules); |
6 | check( | 6 | check( |
7 | r" | 7 | r" |
8 | //- /lib.rs | 8 | //- /lib.rs |
@@ -774,7 +774,7 @@ struct X; | |||
774 | 774 | ||
775 | #[test] | 775 | #[test] |
776 | fn circular_mods() { | 776 | fn circular_mods() { |
777 | mark::check!(circular_mods); | 777 | cov_mark::check!(circular_mods); |
778 | compute_crate_def_map( | 778 | compute_crate_def_map( |
779 | r#" | 779 | r#" |
780 | //- /lib.rs | 780 | //- /lib.rs |
diff --git a/crates/hir_def/src/path/lower/lower_use.rs b/crates/hir_def/src/path/lower/lower_use.rs index d584b0b70..e2965b033 100644 --- a/crates/hir_def/src/path/lower/lower_use.rs +++ b/crates/hir_def/src/path/lower/lower_use.rs | |||
@@ -6,7 +6,6 @@ use std::iter; | |||
6 | use either::Either; | 6 | use either::Either; |
7 | use hir_expand::{hygiene::Hygiene, name::AsName}; | 7 | use hir_expand::{hygiene::Hygiene, name::AsName}; |
8 | use syntax::ast::{self, NameOwner}; | 8 | use syntax::ast::{self, NameOwner}; |
9 | use test_utils::mark; | ||
10 | 9 | ||
11 | use crate::path::{ImportAlias, ModPath, PathKind}; | 10 | use crate::path::{ImportAlias, ModPath, PathKind}; |
12 | 11 | ||
@@ -54,7 +53,7 @@ pub(crate) fn lower_use_tree( | |||
54 | // FIXME: report errors somewhere | 53 | // FIXME: report errors somewhere |
55 | // We get here if we do | 54 | // We get here if we do |
56 | } else if is_glob { | 55 | } else if is_glob { |
57 | mark::hit!(glob_enum_group); | 56 | cov_mark::hit!(glob_enum_group); |
58 | if let Some(prefix) = prefix { | 57 | if let Some(prefix) = prefix { |
59 | cb(prefix, &tree, is_glob, None) | 58 | cb(prefix, &tree, is_glob, None) |
60 | } | 59 | } |
diff --git a/crates/hir_ty/Cargo.toml b/crates/hir_ty/Cargo.toml index 1127eef05..6131ebee8 100644 --- a/crates/hir_ty/Cargo.toml +++ b/crates/hir_ty/Cargo.toml | |||
@@ -10,6 +10,7 @@ edition = "2018" | |||
10 | doctest = false | 10 | doctest = false |
11 | 11 | ||
12 | [dependencies] | 12 | [dependencies] |
13 | cov-mark = "1.1" | ||
13 | itertools = "0.10.0" | 14 | itertools = "0.10.0" |
14 | arrayvec = "0.5.1" | 15 | arrayvec = "0.5.1" |
15 | smallvec = "1.2.0" | 16 | smallvec = "1.2.0" |
diff --git a/crates/hir_ty/src/diagnostics/decl_check.rs b/crates/hir_ty/src/diagnostics/decl_check.rs index 6773ddea3..e230f9765 100644 --- a/crates/hir_ty/src/diagnostics/decl_check.rs +++ b/crates/hir_ty/src/diagnostics/decl_check.rs | |||
@@ -28,7 +28,6 @@ use syntax::{ | |||
28 | ast::{self, NameOwner}, | 28 | ast::{self, NameOwner}, |
29 | AstNode, AstPtr, | 29 | AstNode, AstPtr, |
30 | }; | 30 | }; |
31 | use test_utils::mark; | ||
32 | 31 | ||
33 | use crate::{ | 32 | use crate::{ |
34 | db::HirDatabase, | 33 | db::HirDatabase, |
@@ -93,7 +92,7 @@ impl<'a, 'b> DeclValidator<'a, 'b> { | |||
93 | fn validate_func(&mut self, func: FunctionId) { | 92 | fn validate_func(&mut self, func: FunctionId) { |
94 | let data = self.db.function_data(func); | 93 | let data = self.db.function_data(func); |
95 | if data.is_extern { | 94 | if data.is_extern { |
96 | mark::hit!(extern_func_incorrect_case_ignored); | 95 | cov_mark::hit!(extern_func_incorrect_case_ignored); |
97 | return; | 96 | return; |
98 | } | 97 | } |
99 | 98 | ||
@@ -625,7 +624,7 @@ impl<'a, 'b> DeclValidator<'a, 'b> { | |||
625 | fn validate_static(&mut self, static_id: StaticId) { | 624 | fn validate_static(&mut self, static_id: StaticId) { |
626 | let data = self.db.static_data(static_id); | 625 | let data = self.db.static_data(static_id); |
627 | if data.is_extern { | 626 | if data.is_extern { |
628 | mark::hit!(extern_static_incorrect_case_ignored); | 627 | cov_mark::hit!(extern_static_incorrect_case_ignored); |
629 | return; | 628 | return; |
630 | } | 629 | } |
631 | 630 | ||
@@ -673,8 +672,6 @@ impl<'a, 'b> DeclValidator<'a, 'b> { | |||
673 | 672 | ||
674 | #[cfg(test)] | 673 | #[cfg(test)] |
675 | mod tests { | 674 | mod tests { |
676 | use test_utils::mark; | ||
677 | |||
678 | use crate::diagnostics::tests::check_diagnostics; | 675 | use crate::diagnostics::tests::check_diagnostics; |
679 | 676 | ||
680 | #[test] | 677 | #[test] |
@@ -889,8 +886,8 @@ fn main() { | |||
889 | 886 | ||
890 | #[test] | 887 | #[test] |
891 | fn ignores_extern_items() { | 888 | fn ignores_extern_items() { |
892 | mark::check!(extern_func_incorrect_case_ignored); | 889 | cov_mark::check!(extern_func_incorrect_case_ignored); |
893 | mark::check!(extern_static_incorrect_case_ignored); | 890 | cov_mark::check!(extern_static_incorrect_case_ignored); |
894 | check_diagnostics( | 891 | check_diagnostics( |
895 | r#" | 892 | r#" |
896 | extern { | 893 | extern { |
diff --git a/crates/hir_ty/src/infer/coerce.rs b/crates/hir_ty/src/infer/coerce.rs index cf0a3add4..7e8846f27 100644 --- a/crates/hir_ty/src/infer/coerce.rs +++ b/crates/hir_ty/src/infer/coerce.rs | |||
@@ -6,7 +6,6 @@ | |||
6 | 6 | ||
7 | use chalk_ir::{Mutability, TyVariableKind}; | 7 | use chalk_ir::{Mutability, TyVariableKind}; |
8 | use hir_def::lang_item::LangItemTarget; | 8 | use hir_def::lang_item::LangItemTarget; |
9 | use test_utils::mark; | ||
10 | 9 | ||
11 | use crate::{autoderef, traits::Solution, Obligation, Substs, TraitRef, Ty}; | 10 | use crate::{autoderef, traits::Solution, Obligation, Substs, TraitRef, Ty}; |
12 | 11 | ||
@@ -35,7 +34,7 @@ impl<'a> InferenceContext<'a> { | |||
35 | ty1.clone() | 34 | ty1.clone() |
36 | } else { | 35 | } else { |
37 | if let (Ty::FnDef(..), Ty::FnDef(..)) = (ty1, ty2) { | 36 | if let (Ty::FnDef(..), Ty::FnDef(..)) = (ty1, ty2) { |
38 | mark::hit!(coerce_fn_reification); | 37 | cov_mark::hit!(coerce_fn_reification); |
39 | // Special case: two function types. Try to coerce both to | 38 | // Special case: two function types. Try to coerce both to |
40 | // pointers to have a chance at getting a match. See | 39 | // pointers to have a chance at getting a match. See |
41 | // https://github.com/rust-lang/rust/blob/7b805396bf46dce972692a6846ce2ad8481c5f85/src/librustc_typeck/check/coercion.rs#L877-L916 | 40 | // https://github.com/rust-lang/rust/blob/7b805396bf46dce972692a6846ce2ad8481c5f85/src/librustc_typeck/check/coercion.rs#L877-L916 |
@@ -45,7 +44,7 @@ impl<'a> InferenceContext<'a> { | |||
45 | let ptr_ty2 = Ty::fn_ptr(sig2); | 44 | let ptr_ty2 = Ty::fn_ptr(sig2); |
46 | self.coerce_merge_branch(&ptr_ty1, &ptr_ty2) | 45 | self.coerce_merge_branch(&ptr_ty1, &ptr_ty2) |
47 | } else { | 46 | } else { |
48 | mark::hit!(coerce_merge_fail_fallback); | 47 | cov_mark::hit!(coerce_merge_fail_fallback); |
49 | ty1.clone() | 48 | ty1.clone() |
50 | } | 49 | } |
51 | } | 50 | } |
diff --git a/crates/hir_ty/src/infer/expr.rs b/crates/hir_ty/src/infer/expr.rs index ec2c13154..262177ffb 100644 --- a/crates/hir_ty/src/infer/expr.rs +++ b/crates/hir_ty/src/infer/expr.rs | |||
@@ -12,7 +12,6 @@ use hir_def::{ | |||
12 | }; | 12 | }; |
13 | use hir_expand::name::{name, Name}; | 13 | use hir_expand::name::{name, Name}; |
14 | use syntax::ast::RangeOp; | 14 | use syntax::ast::RangeOp; |
15 | use test_utils::mark; | ||
16 | 15 | ||
17 | use crate::{ | 16 | use crate::{ |
18 | autoderef, | 17 | autoderef, |
@@ -565,7 +564,7 @@ impl<'a> InferenceContext<'a> { | |||
565 | let ret = op::binary_op_return_ty(*op, lhs_ty.clone(), rhs_ty.clone()); | 564 | let ret = op::binary_op_return_ty(*op, lhs_ty.clone(), rhs_ty.clone()); |
566 | 565 | ||
567 | if ret == Ty::Unknown { | 566 | if ret == Ty::Unknown { |
568 | mark::hit!(infer_expr_inner_binary_operator_overload); | 567 | cov_mark::hit!(infer_expr_inner_binary_operator_overload); |
569 | 568 | ||
570 | self.resolve_associated_type_with_params( | 569 | self.resolve_associated_type_with_params( |
571 | lhs_ty, | 570 | lhs_ty, |
diff --git a/crates/hir_ty/src/infer/pat.rs b/crates/hir_ty/src/infer/pat.rs index 987793e2e..a0ac8d80f 100644 --- a/crates/hir_ty/src/infer/pat.rs +++ b/crates/hir_ty/src/infer/pat.rs | |||
@@ -10,7 +10,6 @@ use hir_def::{ | |||
10 | FieldId, | 10 | FieldId, |
11 | }; | 11 | }; |
12 | use hir_expand::name::Name; | 12 | use hir_expand::name::Name; |
13 | use test_utils::mark; | ||
14 | 13 | ||
15 | use super::{BindingMode, Expectation, InferenceContext}; | 14 | use super::{BindingMode, Expectation, InferenceContext}; |
16 | use crate::{lower::lower_to_chalk_mutability, utils::variant_data, Substs, Ty}; | 15 | use crate::{lower::lower_to_chalk_mutability, utils::variant_data, Substs, Ty}; |
@@ -108,7 +107,7 @@ impl<'a> InferenceContext<'a> { | |||
108 | } | 107 | } |
109 | } | 108 | } |
110 | } else if let Pat::Ref { .. } = &body[pat] { | 109 | } else if let Pat::Ref { .. } = &body[pat] { |
111 | mark::hit!(match_ergonomics_ref); | 110 | cov_mark::hit!(match_ergonomics_ref); |
112 | // When you encounter a `&pat` pattern, reset to Move. | 111 | // When you encounter a `&pat` pattern, reset to Move. |
113 | // This is so that `w` is by value: `let (_, &w) = &(1, &2);` | 112 | // This is so that `w` is by value: `let (_, &w) = &(1, &2);` |
114 | default_bm = BindingMode::Move; | 113 | default_bm = BindingMode::Move; |
diff --git a/crates/hir_ty/src/infer/unify.rs b/crates/hir_ty/src/infer/unify.rs index 99a89a7f3..54fcfed10 100644 --- a/crates/hir_ty/src/infer/unify.rs +++ b/crates/hir_ty/src/infer/unify.rs | |||
@@ -5,8 +5,6 @@ use std::borrow::Cow; | |||
5 | use chalk_ir::{FloatTy, IntTy, TyVariableKind}; | 5 | use chalk_ir::{FloatTy, IntTy, TyVariableKind}; |
6 | use ena::unify::{InPlaceUnificationTable, NoError, UnifyKey, UnifyValue}; | 6 | use ena::unify::{InPlaceUnificationTable, NoError, UnifyKey, UnifyValue}; |
7 | 7 | ||
8 | use test_utils::mark; | ||
9 | |||
10 | use super::{InferenceContext, Obligation}; | 8 | use super::{InferenceContext, Obligation}; |
11 | use crate::{ | 9 | use crate::{ |
12 | BoundVar, Canonical, DebruijnIndex, GenericPredicate, InEnvironment, InferenceVar, Scalar, | 10 | BoundVar, Canonical, DebruijnIndex, GenericPredicate, InEnvironment, InferenceVar, Scalar, |
@@ -387,7 +385,7 @@ impl InferenceTable { | |||
387 | // more than once | 385 | // more than once |
388 | for i in 0..3 { | 386 | for i in 0..3 { |
389 | if i > 0 { | 387 | if i > 0 { |
390 | mark::hit!(type_var_resolves_to_int_var); | 388 | cov_mark::hit!(type_var_resolves_to_int_var); |
391 | } | 389 | } |
392 | match &*ty { | 390 | match &*ty { |
393 | Ty::InferenceVar(tv, _) => { | 391 | Ty::InferenceVar(tv, _) => { |
@@ -416,7 +414,7 @@ impl InferenceTable { | |||
416 | Ty::InferenceVar(tv, kind) => { | 414 | Ty::InferenceVar(tv, kind) => { |
417 | let inner = tv.to_inner(); | 415 | let inner = tv.to_inner(); |
418 | if tv_stack.contains(&inner) { | 416 | if tv_stack.contains(&inner) { |
419 | mark::hit!(type_var_cycles_resolve_as_possible); | 417 | cov_mark::hit!(type_var_cycles_resolve_as_possible); |
420 | // recursive type | 418 | // recursive type |
421 | return self.type_variable_table.fallback_value(tv, kind); | 419 | return self.type_variable_table.fallback_value(tv, kind); |
422 | } | 420 | } |
@@ -443,7 +441,7 @@ impl InferenceTable { | |||
443 | Ty::InferenceVar(tv, kind) => { | 441 | Ty::InferenceVar(tv, kind) => { |
444 | let inner = tv.to_inner(); | 442 | let inner = tv.to_inner(); |
445 | if tv_stack.contains(&inner) { | 443 | if tv_stack.contains(&inner) { |
446 | mark::hit!(type_var_cycles_resolve_completely); | 444 | cov_mark::hit!(type_var_cycles_resolve_completely); |
447 | // recursive type | 445 | // recursive type |
448 | return self.type_variable_table.fallback_value(tv, kind); | 446 | return self.type_variable_table.fallback_value(tv, kind); |
449 | } | 447 | } |
diff --git a/crates/hir_ty/src/lower.rs b/crates/hir_ty/src/lower.rs index 5fe5b8ad1..b90fdc382 100644 --- a/crates/hir_ty/src/lower.rs +++ b/crates/hir_ty/src/lower.rs | |||
@@ -24,7 +24,6 @@ use hir_expand::name::Name; | |||
24 | use la_arena::ArenaMap; | 24 | use la_arena::ArenaMap; |
25 | use smallvec::SmallVec; | 25 | use smallvec::SmallVec; |
26 | use stdx::impl_from; | 26 | use stdx::impl_from; |
27 | use test_utils::mark; | ||
28 | 27 | ||
29 | use crate::{ | 28 | use crate::{ |
30 | db::HirDatabase, | 29 | db::HirDatabase, |
@@ -760,7 +759,7 @@ fn assoc_type_bindings_from_type_bound<'a>( | |||
760 | 759 | ||
761 | impl ReturnTypeImplTrait { | 760 | impl ReturnTypeImplTrait { |
762 | fn from_hir(ctx: &TyLoweringContext, bounds: &[TypeBound]) -> Self { | 761 | fn from_hir(ctx: &TyLoweringContext, bounds: &[TypeBound]) -> Self { |
763 | mark::hit!(lower_rpit); | 762 | cov_mark::hit!(lower_rpit); |
764 | let self_ty = Ty::BoundVar(BoundVar::new(DebruijnIndex::INNERMOST, 0)); | 763 | let self_ty = Ty::BoundVar(BoundVar::new(DebruijnIndex::INNERMOST, 0)); |
765 | let predicates = ctx.with_shifted_in(DebruijnIndex::ONE, |ctx| { | 764 | let predicates = ctx.with_shifted_in(DebruijnIndex::ONE, |ctx| { |
766 | bounds | 765 | bounds |
@@ -935,7 +934,7 @@ impl TraitEnvironment { | |||
935 | // add `Self: Trait<T1, T2, ...>` to the environment in trait | 934 | // add `Self: Trait<T1, T2, ...>` to the environment in trait |
936 | // function default implementations (and hypothetical code | 935 | // function default implementations (and hypothetical code |
937 | // inside consts or type aliases) | 936 | // inside consts or type aliases) |
938 | test_utils::mark::hit!(trait_self_implements_self); | 937 | cov_mark::hit!(trait_self_implements_self); |
939 | let substs = Substs::type_params(db, trait_id); | 938 | let substs = Substs::type_params(db, trait_id); |
940 | let trait_ref = TraitRef { trait_: trait_id, substs }; | 939 | let trait_ref = TraitRef { trait_: trait_id, substs }; |
941 | let pred = GenericPredicate::Implemented(trait_ref); | 940 | let pred = GenericPredicate::Implemented(trait_ref); |
diff --git a/crates/hir_ty/src/method_resolution.rs b/crates/hir_ty/src/method_resolution.rs index dfcf346fb..24db33c49 100644 --- a/crates/hir_ty/src/method_resolution.rs +++ b/crates/hir_ty/src/method_resolution.rs | |||
@@ -588,7 +588,7 @@ fn iterate_inherent_methods( | |||
588 | // already happens in `is_valid_candidate` above; if not, we | 588 | // already happens in `is_valid_candidate` above; if not, we |
589 | // check it here | 589 | // check it here |
590 | if receiver_ty.is_none() && inherent_impl_substs(db, impl_def, self_ty).is_none() { | 590 | if receiver_ty.is_none() && inherent_impl_substs(db, impl_def, self_ty).is_none() { |
591 | test_utils::mark::hit!(impl_self_type_match_without_receiver); | 591 | cov_mark::hit!(impl_self_type_match_without_receiver); |
592 | continue; | 592 | continue; |
593 | } | 593 | } |
594 | if callback(&self_ty.value, item) { | 594 | if callback(&self_ty.value, item) { |
diff --git a/crates/hir_ty/src/tests/coercion.rs b/crates/hir_ty/src/tests/coercion.rs index 7bc6c79f3..63d9d4e0b 100644 --- a/crates/hir_ty/src/tests/coercion.rs +++ b/crates/hir_ty/src/tests/coercion.rs | |||
@@ -1,5 +1,4 @@ | |||
1 | use expect_test::expect; | 1 | use expect_test::expect; |
2 | use test_utils::mark; | ||
3 | 2 | ||
4 | use super::{check_infer, check_infer_with_mismatches}; | 3 | use super::{check_infer, check_infer_with_mismatches}; |
5 | 4 | ||
@@ -381,7 +380,7 @@ fn infer_match_second_coerce() { | |||
381 | 380 | ||
382 | #[test] | 381 | #[test] |
383 | fn coerce_merge_one_by_one1() { | 382 | fn coerce_merge_one_by_one1() { |
384 | mark::check!(coerce_merge_fail_fallback); | 383 | cov_mark::check!(coerce_merge_fail_fallback); |
385 | 384 | ||
386 | check_infer( | 385 | check_infer( |
387 | r" | 386 | r" |
@@ -589,7 +588,7 @@ fn coerce_fn_item_to_fn_ptr() { | |||
589 | 588 | ||
590 | #[test] | 589 | #[test] |
591 | fn coerce_fn_items_in_match_arms() { | 590 | fn coerce_fn_items_in_match_arms() { |
592 | mark::check!(coerce_fn_reification); | 591 | cov_mark::check!(coerce_fn_reification); |
593 | 592 | ||
594 | check_infer_with_mismatches( | 593 | check_infer_with_mismatches( |
595 | r" | 594 | r" |
diff --git a/crates/hir_ty/src/tests/method_resolution.rs b/crates/hir_ty/src/tests/method_resolution.rs index a9901d7b8..4e3f9a9b6 100644 --- a/crates/hir_ty/src/tests/method_resolution.rs +++ b/crates/hir_ty/src/tests/method_resolution.rs | |||
@@ -913,7 +913,7 @@ fn test() { S2.into(); } | |||
913 | 913 | ||
914 | #[test] | 914 | #[test] |
915 | fn method_resolution_overloaded_method() { | 915 | fn method_resolution_overloaded_method() { |
916 | test_utils::mark::check!(impl_self_type_match_without_receiver); | 916 | cov_mark::check!(impl_self_type_match_without_receiver); |
917 | check_types( | 917 | check_types( |
918 | r#" | 918 | r#" |
919 | struct Wrapper<T>(T); | 919 | struct Wrapper<T>(T); |
diff --git a/crates/hir_ty/src/tests/patterns.rs b/crates/hir_ty/src/tests/patterns.rs index 2053d8f56..5da19ba5f 100644 --- a/crates/hir_ty/src/tests/patterns.rs +++ b/crates/hir_ty/src/tests/patterns.rs | |||
@@ -1,5 +1,4 @@ | |||
1 | use expect_test::expect; | 1 | use expect_test::expect; |
2 | use test_utils::mark; | ||
3 | 2 | ||
4 | use super::{check_infer, check_infer_with_mismatches}; | 3 | use super::{check_infer, check_infer_with_mismatches}; |
5 | 4 | ||
@@ -197,7 +196,7 @@ fn infer_pattern_match_ergonomics() { | |||
197 | 196 | ||
198 | #[test] | 197 | #[test] |
199 | fn infer_pattern_match_ergonomics_ref() { | 198 | fn infer_pattern_match_ergonomics_ref() { |
200 | mark::check!(match_ergonomics_ref); | 199 | cov_mark::check!(match_ergonomics_ref); |
201 | check_infer( | 200 | check_infer( |
202 | r#" | 201 | r#" |
203 | fn test() { | 202 | fn test() { |
diff --git a/crates/hir_ty/src/tests/regression.rs b/crates/hir_ty/src/tests/regression.rs index cffe8630b..69314e245 100644 --- a/crates/hir_ty/src/tests/regression.rs +++ b/crates/hir_ty/src/tests/regression.rs | |||
@@ -1,5 +1,4 @@ | |||
1 | use expect_test::expect; | 1 | use expect_test::expect; |
2 | use test_utils::mark; | ||
3 | 2 | ||
4 | use super::{check_infer, check_types}; | 3 | use super::{check_infer, check_types}; |
5 | 4 | ||
@@ -87,8 +86,8 @@ fn bug_651() { | |||
87 | 86 | ||
88 | #[test] | 87 | #[test] |
89 | fn recursive_vars() { | 88 | fn recursive_vars() { |
90 | mark::check!(type_var_cycles_resolve_completely); | 89 | cov_mark::check!(type_var_cycles_resolve_completely); |
91 | mark::check!(type_var_cycles_resolve_as_possible); | 90 | cov_mark::check!(type_var_cycles_resolve_as_possible); |
92 | check_infer( | 91 | check_infer( |
93 | r#" | 92 | r#" |
94 | fn test() { | 93 | fn test() { |
@@ -166,7 +165,7 @@ fn infer_std_crash_1() { | |||
166 | 165 | ||
167 | #[test] | 166 | #[test] |
168 | fn infer_std_crash_2() { | 167 | fn infer_std_crash_2() { |
169 | mark::check!(type_var_resolves_to_int_var); | 168 | cov_mark::check!(type_var_resolves_to_int_var); |
170 | // caused "equating two type variables, ...", taken from std | 169 | // caused "equating two type variables, ...", taken from std |
171 | check_infer( | 170 | check_infer( |
172 | r#" | 171 | r#" |
diff --git a/crates/hir_ty/src/tests/simple.rs b/crates/hir_ty/src/tests/simple.rs index 2947857a5..f5069eba5 100644 --- a/crates/hir_ty/src/tests/simple.rs +++ b/crates/hir_ty/src/tests/simple.rs | |||
@@ -1,5 +1,4 @@ | |||
1 | use expect_test::expect; | 1 | use expect_test::expect; |
2 | use test_utils::mark; | ||
3 | 2 | ||
4 | use super::{check_infer, check_types}; | 3 | use super::{check_infer, check_types}; |
5 | 4 | ||
@@ -2314,7 +2313,7 @@ fn generic_default_depending_on_other_type_arg_forward() { | |||
2314 | 2313 | ||
2315 | #[test] | 2314 | #[test] |
2316 | fn infer_operator_overload() { | 2315 | fn infer_operator_overload() { |
2317 | mark::check!(infer_expr_inner_binary_operator_overload); | 2316 | cov_mark::check!(infer_expr_inner_binary_operator_overload); |
2318 | 2317 | ||
2319 | check_infer( | 2318 | check_infer( |
2320 | r#" | 2319 | r#" |
diff --git a/crates/hir_ty/src/tests/traits.rs b/crates/hir_ty/src/tests/traits.rs index 1298e5a88..528092082 100644 --- a/crates/hir_ty/src/tests/traits.rs +++ b/crates/hir_ty/src/tests/traits.rs | |||
@@ -1,5 +1,4 @@ | |||
1 | use expect_test::expect; | 1 | use expect_test::expect; |
2 | use test_utils::mark; | ||
3 | 2 | ||
4 | use super::{check_infer, check_infer_with_mismatches, check_types}; | 3 | use super::{check_infer, check_infer_with_mismatches, check_types}; |
5 | 4 | ||
@@ -319,7 +318,7 @@ fn infer_from_bound_2() { | |||
319 | 318 | ||
320 | #[test] | 319 | #[test] |
321 | fn trait_default_method_self_bound_implements_trait() { | 320 | fn trait_default_method_self_bound_implements_trait() { |
322 | mark::check!(trait_self_implements_self); | 321 | cov_mark::check!(trait_self_implements_self); |
323 | check_infer( | 322 | check_infer( |
324 | r#" | 323 | r#" |
325 | trait Trait { | 324 | trait Trait { |
@@ -1189,7 +1188,7 @@ fn impl_trait() { | |||
1189 | 1188 | ||
1190 | #[test] | 1189 | #[test] |
1191 | fn simple_return_pos_impl_trait() { | 1190 | fn simple_return_pos_impl_trait() { |
1192 | mark::check!(lower_rpit); | 1191 | cov_mark::check!(lower_rpit); |
1193 | check_infer( | 1192 | check_infer( |
1194 | r#" | 1193 | r#" |
1195 | trait Trait<T> { | 1194 | trait Trait<T> { |
diff --git a/crates/ide/Cargo.toml b/crates/ide/Cargo.toml index f6aaaeda4..f7c5efaf3 100644 --- a/crates/ide/Cargo.toml +++ b/crates/ide/Cargo.toml | |||
@@ -10,6 +10,7 @@ edition = "2018" | |||
10 | doctest = false | 10 | doctest = false |
11 | 11 | ||
12 | [dependencies] | 12 | [dependencies] |
13 | cov-mark = "1.1" | ||
13 | either = "1.5.3" | 14 | either = "1.5.3" |
14 | indexmap = "1.4.0" | 15 | indexmap = "1.4.0" |
15 | itertools = "0.10.0" | 16 | itertools = "0.10.0" |
diff --git a/crates/ide/src/hover.rs b/crates/ide/src/hover.rs index a9454cfa3..5d1cc2052 100644 --- a/crates/ide/src/hover.rs +++ b/crates/ide/src/hover.rs | |||
@@ -11,7 +11,6 @@ use ide_db::{ | |||
11 | use itertools::Itertools; | 11 | use itertools::Itertools; |
12 | use stdx::format_to; | 12 | use stdx::format_to; |
13 | use syntax::{ast, match_ast, AstNode, SyntaxKind::*, SyntaxToken, TokenAtOffset, T}; | 13 | use syntax::{ast, match_ast, AstNode, SyntaxKind::*, SyntaxToken, TokenAtOffset, T}; |
14 | use test_utils::mark; | ||
15 | 14 | ||
16 | use crate::{ | 15 | use crate::{ |
17 | display::{macro_label, ShortLabel, TryToNav}, | 16 | display::{macro_label, ShortLabel, TryToNav}, |
@@ -193,8 +192,8 @@ fn runnable_action( | |||
193 | ModuleDef::Function(func) => { | 192 | ModuleDef::Function(func) => { |
194 | let src = func.source(sema.db)?; | 193 | let src = func.source(sema.db)?; |
195 | if src.file_id != file_id.into() { | 194 | if src.file_id != file_id.into() { |
196 | mark::hit!(hover_macro_generated_struct_fn_doc_comment); | 195 | cov_mark::hit!(hover_macro_generated_struct_fn_doc_comment); |
197 | mark::hit!(hover_macro_generated_struct_fn_doc_attr); | 196 | cov_mark::hit!(hover_macro_generated_struct_fn_doc_attr); |
198 | return None; | 197 | return None; |
199 | } | 198 | } |
200 | 199 | ||
@@ -2101,7 +2100,7 @@ pub fn fo$0o() {} | |||
2101 | 2100 | ||
2102 | #[test] | 2101 | #[test] |
2103 | fn test_hover_macro_generated_struct_fn_doc_comment() { | 2102 | fn test_hover_macro_generated_struct_fn_doc_comment() { |
2104 | mark::check!(hover_macro_generated_struct_fn_doc_comment); | 2103 | cov_mark::check!(hover_macro_generated_struct_fn_doc_comment); |
2105 | 2104 | ||
2106 | check( | 2105 | check( |
2107 | r#" | 2106 | r#" |
@@ -2139,7 +2138,7 @@ fn foo() { let bar = Bar; bar.fo$0o(); } | |||
2139 | 2138 | ||
2140 | #[test] | 2139 | #[test] |
2141 | fn test_hover_macro_generated_struct_fn_doc_attr() { | 2140 | fn test_hover_macro_generated_struct_fn_doc_attr() { |
2142 | mark::check!(hover_macro_generated_struct_fn_doc_attr); | 2141 | cov_mark::check!(hover_macro_generated_struct_fn_doc_attr); |
2143 | 2142 | ||
2144 | check( | 2143 | check( |
2145 | r#" | 2144 | r#" |
diff --git a/crates/ide/src/join_lines.rs b/crates/ide/src/join_lines.rs index 7fcae13e0..20a920ddb 100644 --- a/crates/ide/src/join_lines.rs +++ b/crates/ide/src/join_lines.rs | |||
@@ -7,7 +7,7 @@ use syntax::{ | |||
7 | SyntaxKind::{self, USE_TREE, WHITESPACE}, | 7 | SyntaxKind::{self, USE_TREE, WHITESPACE}, |
8 | SyntaxNode, SyntaxToken, TextRange, TextSize, T, | 8 | SyntaxNode, SyntaxToken, TextRange, TextSize, T, |
9 | }; | 9 | }; |
10 | use test_utils::mark; | 10 | |
11 | use text_edit::{TextEdit, TextEditBuilder}; | 11 | use text_edit::{TextEdit, TextEditBuilder}; |
12 | 12 | ||
13 | // Feature: Join Lines | 13 | // Feature: Join Lines |
@@ -60,7 +60,7 @@ fn remove_newline(edit: &mut TextEditBuilder, token: &SyntaxToken, offset: TextS | |||
60 | let mut string_open_quote = false; | 60 | let mut string_open_quote = false; |
61 | if let Some(string) = ast::String::cast(token.clone()) { | 61 | if let Some(string) = ast::String::cast(token.clone()) { |
62 | if let Some(range) = string.open_quote_text_range() { | 62 | if let Some(range) = string.open_quote_text_range() { |
63 | mark::hit!(join_string_literal); | 63 | cov_mark::hit!(join_string_literal); |
64 | string_open_quote = range.end() == offset; | 64 | string_open_quote = range.end() == offset; |
65 | } | 65 | } |
66 | } | 66 | } |
@@ -206,7 +206,7 @@ fn compute_ws(left: SyntaxKind, right: SyntaxKind) -> &'static str { | |||
206 | #[cfg(test)] | 206 | #[cfg(test)] |
207 | mod tests { | 207 | mod tests { |
208 | use syntax::SourceFile; | 208 | use syntax::SourceFile; |
209 | use test_utils::{add_cursor, assert_eq_text, extract_offset, extract_range, mark}; | 209 | use test_utils::{add_cursor, assert_eq_text, extract_offset, extract_range}; |
210 | 210 | ||
211 | use super::*; | 211 | use super::*; |
212 | 212 | ||
@@ -786,7 +786,7 @@ fn foo() { | |||
786 | 786 | ||
787 | #[test] | 787 | #[test] |
788 | fn join_string_literal() { | 788 | fn join_string_literal() { |
789 | mark::check!(join_string_literal); | 789 | cov_mark::check!(join_string_literal); |
790 | check_join_lines( | 790 | check_join_lines( |
791 | r#" | 791 | r#" |
792 | fn main() { | 792 | fn main() { |
diff --git a/crates/ide/src/matching_brace.rs b/crates/ide/src/matching_brace.rs index 1bfa1439d..000c412d9 100644 --- a/crates/ide/src/matching_brace.rs +++ b/crates/ide/src/matching_brace.rs | |||
@@ -2,7 +2,6 @@ use syntax::{ | |||
2 | ast::{self, AstNode}, | 2 | ast::{self, AstNode}, |
3 | SourceFile, SyntaxKind, TextSize, T, | 3 | SourceFile, SyntaxKind, TextSize, T, |
4 | }; | 4 | }; |
5 | use test_utils::mark; | ||
6 | 5 | ||
7 | // Feature: Matching Brace | 6 | // Feature: Matching Brace |
8 | // | 7 | // |
@@ -28,7 +27,7 @@ pub(crate) fn matching_brace(file: &SourceFile, offset: TextSize) -> Option<Text | |||
28 | .next()?; | 27 | .next()?; |
29 | let parent = brace_token.parent(); | 28 | let parent = brace_token.parent(); |
30 | if brace_token.kind() == T![|] && !ast::ParamList::can_cast(parent.kind()) { | 29 | if brace_token.kind() == T![|] && !ast::ParamList::can_cast(parent.kind()) { |
31 | mark::hit!(pipes_not_braces); | 30 | cov_mark::hit!(pipes_not_braces); |
32 | return None; | 31 | return None; |
33 | } | 32 | } |
34 | let matching_kind = BRACES[brace_idx ^ 1]; | 33 | let matching_kind = BRACES[brace_idx ^ 1]; |
@@ -63,7 +62,7 @@ mod tests { | |||
63 | do_check("fn main() { $0|x: i32| x * 2;}", "fn main() { |x: i32$0| x * 2;}"); | 62 | do_check("fn main() { $0|x: i32| x * 2;}", "fn main() { |x: i32$0| x * 2;}"); |
64 | 63 | ||
65 | { | 64 | { |
66 | mark::check!(pipes_not_braces); | 65 | cov_mark::check!(pipes_not_braces); |
67 | do_check( | 66 | do_check( |
68 | "fn main() { match 92 { 1 | 2 |$0 3 => 92 } }", | 67 | "fn main() { match 92 { 1 | 2 |$0 3 => 92 } }", |
69 | "fn main() { match 92 { 1 | 2 |$0 3 => 92 } }", | 68 | "fn main() { match 92 { 1 | 2 |$0 3 => 92 } }", |
diff --git a/crates/ide/src/parent_module.rs b/crates/ide/src/parent_module.rs index ddbaf22b7..03d71b380 100644 --- a/crates/ide/src/parent_module.rs +++ b/crates/ide/src/parent_module.rs | |||
@@ -5,7 +5,6 @@ use syntax::{ | |||
5 | algo::find_node_at_offset, | 5 | algo::find_node_at_offset, |
6 | ast::{self, AstNode}, | 6 | ast::{self, AstNode}, |
7 | }; | 7 | }; |
8 | use test_utils::mark; | ||
9 | 8 | ||
10 | use crate::NavigationTarget; | 9 | use crate::NavigationTarget; |
11 | 10 | ||
@@ -33,7 +32,7 @@ pub(crate) fn parent_module(db: &RootDatabase, position: FilePosition) -> Vec<Na | |||
33 | .item_list() | 32 | .item_list() |
34 | .map_or(false, |it| it.syntax().text_range().contains_inclusive(position.offset)) | 33 | .map_or(false, |it| it.syntax().text_range().contains_inclusive(position.offset)) |
35 | { | 34 | { |
36 | mark::hit!(test_resolve_parent_module_on_module_decl); | 35 | cov_mark::hit!(test_resolve_parent_module_on_module_decl); |
37 | module = m.syntax().ancestors().skip(1).find_map(ast::Module::cast); | 36 | module = m.syntax().ancestors().skip(1).find_map(ast::Module::cast); |
38 | } | 37 | } |
39 | } | 38 | } |
@@ -64,7 +63,6 @@ pub(crate) fn crate_for(db: &RootDatabase, file_id: FileId) -> Vec<CrateId> { | |||
64 | #[cfg(test)] | 63 | #[cfg(test)] |
65 | mod tests { | 64 | mod tests { |
66 | use ide_db::base_db::FileRange; | 65 | use ide_db::base_db::FileRange; |
67 | use test_utils::mark; | ||
68 | 66 | ||
69 | use crate::fixture; | 67 | use crate::fixture; |
70 | 68 | ||
@@ -92,7 +90,7 @@ $0// empty | |||
92 | 90 | ||
93 | #[test] | 91 | #[test] |
94 | fn test_resolve_parent_module_on_module_decl() { | 92 | fn test_resolve_parent_module_on_module_decl() { |
95 | mark::check!(test_resolve_parent_module_on_module_decl); | 93 | cov_mark::check!(test_resolve_parent_module_on_module_decl); |
96 | check( | 94 | check( |
97 | r#" | 95 | r#" |
98 | //- /lib.rs | 96 | //- /lib.rs |
diff --git a/crates/ide/src/references/rename.rs b/crates/ide/src/references/rename.rs index 1919639a3..05c73de88 100644 --- a/crates/ide/src/references/rename.rs +++ b/crates/ide/src/references/rename.rs | |||
@@ -14,7 +14,7 @@ use syntax::{ | |||
14 | ast::{self, NameOwner}, | 14 | ast::{self, NameOwner}, |
15 | lex_single_syntax_kind, AstNode, SyntaxKind, SyntaxNode, T, | 15 | lex_single_syntax_kind, AstNode, SyntaxKind, SyntaxNode, T, |
16 | }; | 16 | }; |
17 | use test_utils::mark; | 17 | |
18 | use text_edit::TextEdit; | 18 | use text_edit::TextEdit; |
19 | 19 | ||
20 | use crate::{display::TryToNav, FilePosition, FileSystemEdit, RangeInfo, SourceChange, TextRange}; | 20 | use crate::{display::TryToNav, FilePosition, FileSystemEdit, RangeInfo, SourceChange, TextRange}; |
@@ -226,34 +226,36 @@ fn rename_reference( | |||
226 | | (IdentifierKind::Ident, _) | 226 | | (IdentifierKind::Ident, _) |
227 | if def_is_lbl_or_lt => | 227 | if def_is_lbl_or_lt => |
228 | { | 228 | { |
229 | mark::hit!(rename_not_a_lifetime_ident_ref); | 229 | cov_mark::hit!(rename_not_a_lifetime_ident_ref); |
230 | bail!("Invalid name `{}`: not a lifetime identifier", new_name) | 230 | bail!("Invalid name `{}`: not a lifetime identifier", new_name) |
231 | } | 231 | } |
232 | (IdentifierKind::Lifetime, _) if def_is_lbl_or_lt => mark::hit!(rename_lifetime), | 232 | (IdentifierKind::Lifetime, _) if def_is_lbl_or_lt => cov_mark::hit!(rename_lifetime), |
233 | (IdentifierKind::Lifetime, _) => { | 233 | (IdentifierKind::Lifetime, _) => { |
234 | mark::hit!(rename_not_an_ident_ref); | 234 | cov_mark::hit!(rename_not_an_ident_ref); |
235 | bail!("Invalid name `{}`: not an identifier", new_name) | 235 | bail!("Invalid name `{}`: not an identifier", new_name) |
236 | } | 236 | } |
237 | (IdentifierKind::ToSelf, Definition::Local(local)) if local.is_self(sema.db) => { | 237 | (IdentifierKind::ToSelf, Definition::Local(local)) if local.is_self(sema.db) => { |
238 | // no-op | 238 | // no-op |
239 | mark::hit!(rename_self_to_self); | 239 | cov_mark::hit!(rename_self_to_self); |
240 | return Ok(SourceChange::default()); | 240 | return Ok(SourceChange::default()); |
241 | } | 241 | } |
242 | (ident_kind, Definition::Local(local)) if local.is_self(sema.db) => { | 242 | (ident_kind, Definition::Local(local)) if local.is_self(sema.db) => { |
243 | mark::hit!(rename_self_to_param); | 243 | cov_mark::hit!(rename_self_to_param); |
244 | return rename_self_to_param(sema, local, new_name, ident_kind); | 244 | return rename_self_to_param(sema, local, new_name, ident_kind); |
245 | } | 245 | } |
246 | (IdentifierKind::ToSelf, Definition::Local(local)) => { | 246 | (IdentifierKind::ToSelf, Definition::Local(local)) => { |
247 | mark::hit!(rename_to_self); | 247 | cov_mark::hit!(rename_to_self); |
248 | return rename_to_self(sema, local); | 248 | return rename_to_self(sema, local); |
249 | } | 249 | } |
250 | (IdentifierKind::ToSelf, _) => bail!("Invalid name `{}`: not an identifier", new_name), | 250 | (IdentifierKind::ToSelf, _) => bail!("Invalid name `{}`: not an identifier", new_name), |
251 | (IdentifierKind::Ident, _) | (IdentifierKind::Underscore, _) => mark::hit!(rename_ident), | 251 | (IdentifierKind::Ident, _) | (IdentifierKind::Underscore, _) => { |
252 | cov_mark::hit!(rename_ident) | ||
253 | } | ||
252 | } | 254 | } |
253 | 255 | ||
254 | let usages = def.usages(sema).all(); | 256 | let usages = def.usages(sema).all(); |
255 | if !usages.is_empty() && ident_kind == IdentifierKind::Underscore { | 257 | if !usages.is_empty() && ident_kind == IdentifierKind::Underscore { |
256 | mark::hit!(rename_underscore_multiple); | 258 | cov_mark::hit!(rename_underscore_multiple); |
257 | bail!("Cannot rename reference to `_` as it is being referenced multiple times"); | 259 | bail!("Cannot rename reference to `_` as it is being referenced multiple times"); |
258 | } | 260 | } |
259 | let mut source_change = SourceChange::default(); | 261 | let mut source_change = SourceChange::default(); |
@@ -444,7 +446,7 @@ fn source_edit_from_name_ref( | |||
444 | (Some(field_name), Some(init)) => { | 446 | (Some(field_name), Some(init)) => { |
445 | if field_name == *name_ref { | 447 | if field_name == *name_ref { |
446 | if init.text() == new_name { | 448 | if init.text() == new_name { |
447 | mark::hit!(test_rename_field_put_init_shorthand); | 449 | cov_mark::hit!(test_rename_field_put_init_shorthand); |
448 | // same names, we can use a shorthand here instead. | 450 | // same names, we can use a shorthand here instead. |
449 | // we do not want to erase attributes hence this range start | 451 | // we do not want to erase attributes hence this range start |
450 | let s = field_name.syntax().text_range().start(); | 452 | let s = field_name.syntax().text_range().start(); |
@@ -453,7 +455,7 @@ fn source_edit_from_name_ref( | |||
453 | } | 455 | } |
454 | } else if init == *name_ref { | 456 | } else if init == *name_ref { |
455 | if field_name.text() == new_name { | 457 | if field_name.text() == new_name { |
456 | mark::hit!(test_rename_local_put_init_shorthand); | 458 | cov_mark::hit!(test_rename_local_put_init_shorthand); |
457 | // same names, we can use a shorthand here instead. | 459 | // same names, we can use a shorthand here instead. |
458 | // we do not want to erase attributes hence this range start | 460 | // we do not want to erase attributes hence this range start |
459 | let s = field_name.syntax().text_range().start(); | 461 | let s = field_name.syntax().text_range().start(); |
@@ -467,12 +469,12 @@ fn source_edit_from_name_ref( | |||
467 | // FIXME: instead of splitting the shorthand, recursively trigger a rename of the | 469 | // FIXME: instead of splitting the shorthand, recursively trigger a rename of the |
468 | // other name https://github.com/rust-analyzer/rust-analyzer/issues/6547 | 470 | // other name https://github.com/rust-analyzer/rust-analyzer/issues/6547 |
469 | (None, Some(_)) if matches!(def, Definition::Field(_)) => { | 471 | (None, Some(_)) if matches!(def, Definition::Field(_)) => { |
470 | mark::hit!(test_rename_field_in_field_shorthand); | 472 | cov_mark::hit!(test_rename_field_in_field_shorthand); |
471 | let s = name_ref.syntax().text_range().start(); | 473 | let s = name_ref.syntax().text_range().start(); |
472 | Some((TextRange::empty(s), format!("{}: ", new_name))) | 474 | Some((TextRange::empty(s), format!("{}: ", new_name))) |
473 | } | 475 | } |
474 | (None, Some(_)) if matches!(def, Definition::Local(_)) => { | 476 | (None, Some(_)) if matches!(def, Definition::Local(_)) => { |
475 | mark::hit!(test_rename_local_in_field_shorthand); | 477 | cov_mark::hit!(test_rename_local_in_field_shorthand); |
476 | let s = name_ref.syntax().text_range().end(); | 478 | let s = name_ref.syntax().text_range().end(); |
477 | Some((TextRange::empty(s), format!(": {}", new_name))) | 479 | Some((TextRange::empty(s), format!(": {}", new_name))) |
478 | } | 480 | } |
@@ -486,7 +488,7 @@ fn source_edit_from_name_ref( | |||
486 | (Some(field_name), Some(ast::Pat::IdentPat(pat))) if field_name == *name_ref => { | 488 | (Some(field_name), Some(ast::Pat::IdentPat(pat))) if field_name == *name_ref => { |
487 | // field name is being renamed | 489 | // field name is being renamed |
488 | if pat.name().map_or(false, |it| it.text() == new_name) { | 490 | if pat.name().map_or(false, |it| it.text() == new_name) { |
489 | mark::hit!(test_rename_field_put_init_shorthand_pat); | 491 | cov_mark::hit!(test_rename_field_put_init_shorthand_pat); |
490 | // same names, we can use a shorthand here instead/ | 492 | // same names, we can use a shorthand here instead/ |
491 | // we do not want to erase attributes hence this range start | 493 | // we do not want to erase attributes hence this range start |
492 | let s = field_name.syntax().text_range().start(); | 494 | let s = field_name.syntax().text_range().start(); |
@@ -538,7 +540,7 @@ fn source_edit_from_def( | |||
538 | mod tests { | 540 | mod tests { |
539 | use expect_test::{expect, Expect}; | 541 | use expect_test::{expect, Expect}; |
540 | use stdx::trim_indent; | 542 | use stdx::trim_indent; |
541 | use test_utils::{assert_eq_text, mark}; | 543 | use test_utils::assert_eq_text; |
542 | use text_edit::TextEdit; | 544 | use text_edit::TextEdit; |
543 | 545 | ||
544 | use crate::{fixture, FileId}; | 546 | use crate::{fixture, FileId}; |
@@ -627,7 +629,7 @@ mod tests { | |||
627 | 629 | ||
628 | #[test] | 630 | #[test] |
629 | fn test_rename_to_invalid_identifier_lifetime() { | 631 | fn test_rename_to_invalid_identifier_lifetime() { |
630 | mark::check!(rename_not_an_ident_ref); | 632 | cov_mark::check!(rename_not_an_ident_ref); |
631 | check( | 633 | check( |
632 | "'foo", | 634 | "'foo", |
633 | r#"fn main() { let i$0 = 1; }"#, | 635 | r#"fn main() { let i$0 = 1; }"#, |
@@ -637,7 +639,7 @@ mod tests { | |||
637 | 639 | ||
638 | #[test] | 640 | #[test] |
639 | fn test_rename_to_invalid_identifier_lifetime2() { | 641 | fn test_rename_to_invalid_identifier_lifetime2() { |
640 | mark::check!(rename_not_a_lifetime_ident_ref); | 642 | cov_mark::check!(rename_not_a_lifetime_ident_ref); |
641 | check( | 643 | check( |
642 | "foo", | 644 | "foo", |
643 | r#"fn main<'a>(_: &'a$0 ()) {}"#, | 645 | r#"fn main<'a>(_: &'a$0 ()) {}"#, |
@@ -647,7 +649,7 @@ mod tests { | |||
647 | 649 | ||
648 | #[test] | 650 | #[test] |
649 | fn test_rename_to_underscore_invalid() { | 651 | fn test_rename_to_underscore_invalid() { |
650 | mark::check!(rename_underscore_multiple); | 652 | cov_mark::check!(rename_underscore_multiple); |
651 | check( | 653 | check( |
652 | "_", | 654 | "_", |
653 | r#"fn main(foo$0: ()) {foo;}"#, | 655 | r#"fn main(foo$0: ()) {foo;}"#, |
@@ -666,7 +668,7 @@ mod tests { | |||
666 | 668 | ||
667 | #[test] | 669 | #[test] |
668 | fn test_rename_for_local() { | 670 | fn test_rename_for_local() { |
669 | mark::check!(rename_ident); | 671 | cov_mark::check!(rename_ident); |
670 | check( | 672 | check( |
671 | "k", | 673 | "k", |
672 | r#" | 674 | r#" |
@@ -829,7 +831,7 @@ impl Foo { | |||
829 | 831 | ||
830 | #[test] | 832 | #[test] |
831 | fn test_rename_field_in_field_shorthand() { | 833 | fn test_rename_field_in_field_shorthand() { |
832 | mark::check!(test_rename_field_in_field_shorthand); | 834 | cov_mark::check!(test_rename_field_in_field_shorthand); |
833 | check( | 835 | check( |
834 | "j", | 836 | "j", |
835 | r#" | 837 | r#" |
@@ -855,7 +857,7 @@ impl Foo { | |||
855 | 857 | ||
856 | #[test] | 858 | #[test] |
857 | fn test_rename_local_in_field_shorthand() { | 859 | fn test_rename_local_in_field_shorthand() { |
858 | mark::check!(test_rename_local_in_field_shorthand); | 860 | cov_mark::check!(test_rename_local_in_field_shorthand); |
859 | check( | 861 | check( |
860 | "j", | 862 | "j", |
861 | r#" | 863 | r#" |
@@ -1261,7 +1263,7 @@ fn foo(f: foo::Foo) { | |||
1261 | 1263 | ||
1262 | #[test] | 1264 | #[test] |
1263 | fn test_parameter_to_self() { | 1265 | fn test_parameter_to_self() { |
1264 | mark::check!(rename_to_self); | 1266 | cov_mark::check!(rename_to_self); |
1265 | check( | 1267 | check( |
1266 | "self", | 1268 | "self", |
1267 | r#" | 1269 | r#" |
@@ -1401,7 +1403,7 @@ impl Foo { | |||
1401 | 1403 | ||
1402 | #[test] | 1404 | #[test] |
1403 | fn test_owned_self_to_parameter() { | 1405 | fn test_owned_self_to_parameter() { |
1404 | mark::check!(rename_self_to_param); | 1406 | cov_mark::check!(rename_self_to_param); |
1405 | check( | 1407 | check( |
1406 | "foo", | 1408 | "foo", |
1407 | r#" | 1409 | r#" |
@@ -1454,7 +1456,7 @@ impl Foo { | |||
1454 | 1456 | ||
1455 | #[test] | 1457 | #[test] |
1456 | fn test_rename_field_put_init_shorthand() { | 1458 | fn test_rename_field_put_init_shorthand() { |
1457 | mark::check!(test_rename_field_put_init_shorthand); | 1459 | cov_mark::check!(test_rename_field_put_init_shorthand); |
1458 | check( | 1460 | check( |
1459 | "bar", | 1461 | "bar", |
1460 | r#" | 1462 | r#" |
@@ -1476,7 +1478,7 @@ fn foo(bar: i32) -> Foo { | |||
1476 | 1478 | ||
1477 | #[test] | 1479 | #[test] |
1478 | fn test_rename_local_put_init_shorthand() { | 1480 | fn test_rename_local_put_init_shorthand() { |
1479 | mark::check!(test_rename_local_put_init_shorthand); | 1481 | cov_mark::check!(test_rename_local_put_init_shorthand); |
1480 | check( | 1482 | check( |
1481 | "i", | 1483 | "i", |
1482 | r#" | 1484 | r#" |
@@ -1498,7 +1500,7 @@ fn foo(i: i32) -> Foo { | |||
1498 | 1500 | ||
1499 | #[test] | 1501 | #[test] |
1500 | fn test_struct_field_pat_into_shorthand() { | 1502 | fn test_struct_field_pat_into_shorthand() { |
1501 | mark::check!(test_rename_field_put_init_shorthand_pat); | 1503 | cov_mark::check!(test_rename_field_put_init_shorthand_pat); |
1502 | check( | 1504 | check( |
1503 | "baz", | 1505 | "baz", |
1504 | r#" | 1506 | r#" |
@@ -1610,7 +1612,7 @@ fn foo(foo: Foo) { | |||
1610 | 1612 | ||
1611 | #[test] | 1613 | #[test] |
1612 | fn test_rename_lifetimes() { | 1614 | fn test_rename_lifetimes() { |
1613 | mark::check!(rename_lifetime); | 1615 | cov_mark::check!(rename_lifetime); |
1614 | check( | 1616 | check( |
1615 | "'yeeee", | 1617 | "'yeeee", |
1616 | r#" | 1618 | r#" |
@@ -1698,7 +1700,7 @@ fn foo<'a>() -> &'a () { | |||
1698 | 1700 | ||
1699 | #[test] | 1701 | #[test] |
1700 | fn test_self_to_self() { | 1702 | fn test_self_to_self() { |
1701 | mark::check!(rename_self_to_self); | 1703 | cov_mark::check!(rename_self_to_self); |
1702 | check( | 1704 | check( |
1703 | "self", | 1705 | "self", |
1704 | r#" | 1706 | r#" |
diff --git a/crates/ide/src/runnables.rs b/crates/ide/src/runnables.rs index 65f60891e..280565563 100644 --- a/crates/ide/src/runnables.rs +++ b/crates/ide/src/runnables.rs | |||
@@ -9,7 +9,6 @@ use syntax::{ | |||
9 | ast::{self, AstNode, AttrsOwner}, | 9 | ast::{self, AstNode, AttrsOwner}, |
10 | match_ast, SyntaxNode, | 10 | match_ast, SyntaxNode, |
11 | }; | 11 | }; |
12 | use test_utils::mark; | ||
13 | 12 | ||
14 | use crate::{ | 13 | use crate::{ |
15 | display::{ToNav, TryToNav}, | 14 | display::{ToNav, TryToNav}, |
@@ -130,7 +129,9 @@ fn runnables_mod(sema: &Semantics<RootDatabase>, acc: &mut Vec<Runnable>, module | |||
130 | if let hir::ModuleDef::Module(submodule) = def { | 129 | if let hir::ModuleDef::Module(submodule) = def { |
131 | match submodule.definition_source(sema.db).value { | 130 | match submodule.definition_source(sema.db).value { |
132 | hir::ModuleSource::Module(_) => runnables_mod(sema, acc, submodule), | 131 | hir::ModuleSource::Module(_) => runnables_mod(sema, acc, submodule), |
133 | hir::ModuleSource::SourceFile(_) => mark::hit!(dont_recurse_in_outline_submodules), | 132 | hir::ModuleSource::SourceFile(_) => { |
133 | cov_mark::hit!(dont_recurse_in_outline_submodules) | ||
134 | } | ||
134 | hir::ModuleSource::BlockExpr(_) => {} // inner items aren't runnable | 135 | hir::ModuleSource::BlockExpr(_) => {} // inner items aren't runnable |
135 | } | 136 | } |
136 | } | 137 | } |
@@ -328,7 +329,6 @@ fn has_test_function_or_multiple_test_submodules( | |||
328 | #[cfg(test)] | 329 | #[cfg(test)] |
329 | mod tests { | 330 | mod tests { |
330 | use expect_test::{expect, Expect}; | 331 | use expect_test::{expect, Expect}; |
331 | use test_utils::mark; | ||
332 | 332 | ||
333 | use crate::fixture; | 333 | use crate::fixture; |
334 | 334 | ||
@@ -1056,7 +1056,7 @@ mod tests { | |||
1056 | 1056 | ||
1057 | #[test] | 1057 | #[test] |
1058 | fn dont_recurse_in_outline_submodules() { | 1058 | fn dont_recurse_in_outline_submodules() { |
1059 | mark::check!(dont_recurse_in_outline_submodules); | 1059 | cov_mark::check!(dont_recurse_in_outline_submodules); |
1060 | check( | 1060 | check( |
1061 | r#" | 1061 | r#" |
1062 | //- /lib.rs | 1062 | //- /lib.rs |
diff --git a/crates/ide/src/typing/on_enter.rs b/crates/ide/src/typing/on_enter.rs index 63cd51b69..978c479de 100644 --- a/crates/ide/src/typing/on_enter.rs +++ b/crates/ide/src/typing/on_enter.rs | |||
@@ -9,7 +9,7 @@ use syntax::{ | |||
9 | SyntaxKind::*, | 9 | SyntaxKind::*, |
10 | SyntaxToken, TextRange, TextSize, TokenAtOffset, | 10 | SyntaxToken, TextRange, TextSize, TokenAtOffset, |
11 | }; | 11 | }; |
12 | use test_utils::mark; | 12 | |
13 | use text_edit::TextEdit; | 13 | use text_edit::TextEdit; |
14 | 14 | ||
15 | // Feature: On Enter | 15 | // Feature: On Enter |
@@ -55,7 +55,7 @@ pub(crate) fn on_enter(db: &RootDatabase, position: FilePosition) -> Option<Text | |||
55 | // Continuing single-line non-doc comments (like this one :) ) is annoying | 55 | // Continuing single-line non-doc comments (like this one :) ) is annoying |
56 | if prefix == "//" && comment_range.end() == position.offset { | 56 | if prefix == "//" && comment_range.end() == position.offset { |
57 | if comment.text().ends_with(' ') { | 57 | if comment.text().ends_with(' ') { |
58 | mark::hit!(continues_end_of_line_comment_with_space); | 58 | cov_mark::hit!(continues_end_of_line_comment_with_space); |
59 | remove_trailing_whitespace = true; | 59 | remove_trailing_whitespace = true; |
60 | } else if !followed_by_comment(&comment) { | 60 | } else if !followed_by_comment(&comment) { |
61 | return None; | 61 | return None; |
@@ -109,7 +109,7 @@ fn node_indent(file: &SourceFile, token: &SyntaxToken) -> Option<SmolStr> { | |||
109 | #[cfg(test)] | 109 | #[cfg(test)] |
110 | mod tests { | 110 | mod tests { |
111 | use stdx::trim_indent; | 111 | use stdx::trim_indent; |
112 | use test_utils::{assert_eq_text, mark}; | 112 | use test_utils::assert_eq_text; |
113 | 113 | ||
114 | use crate::fixture; | 114 | use crate::fixture; |
115 | 115 | ||
@@ -238,7 +238,7 @@ fn main() { | |||
238 | 238 | ||
239 | #[test] | 239 | #[test] |
240 | fn continues_end_of_line_comment_with_space() { | 240 | fn continues_end_of_line_comment_with_space() { |
241 | mark::check!(continues_end_of_line_comment_with_space); | 241 | cov_mark::check!(continues_end_of_line_comment_with_space); |
242 | do_check( | 242 | do_check( |
243 | r#" | 243 | r#" |
244 | fn main() { | 244 | fn main() { |
diff --git a/crates/ide_assists/Cargo.toml b/crates/ide_assists/Cargo.toml index a34bdd6c3..3bf0099a9 100644 --- a/crates/ide_assists/Cargo.toml +++ b/crates/ide_assists/Cargo.toml | |||
@@ -10,6 +10,7 @@ edition = "2018" | |||
10 | doctest = false | 10 | doctest = false |
11 | 11 | ||
12 | [dependencies] | 12 | [dependencies] |
13 | cov-mark = "1.1" | ||
13 | rustc-hash = "1.1.0" | 14 | rustc-hash = "1.1.0" |
14 | itertools = "0.10.0" | 15 | itertools = "0.10.0" |
15 | either = "1.6.1" | 16 | either = "1.6.1" |
diff --git a/crates/ide_assists/src/handlers/add_turbo_fish.rs b/crates/ide_assists/src/handlers/add_turbo_fish.rs index a08b55ebb..3b6efbab4 100644 --- a/crates/ide_assists/src/handlers/add_turbo_fish.rs +++ b/crates/ide_assists/src/handlers/add_turbo_fish.rs | |||
@@ -1,6 +1,5 @@ | |||
1 | use ide_db::defs::{Definition, NameRefClass}; | 1 | use ide_db::defs::{Definition, NameRefClass}; |
2 | use syntax::{ast, AstNode, SyntaxKind, T}; | 2 | use syntax::{ast, AstNode, SyntaxKind, T}; |
3 | use test_utils::mark; | ||
4 | 3 | ||
5 | use crate::{ | 4 | use crate::{ |
6 | assist_context::{AssistContext, Assists}, | 5 | assist_context::{AssistContext, Assists}, |
@@ -30,13 +29,13 @@ pub(crate) fn add_turbo_fish(acc: &mut Assists, ctx: &AssistContext) -> Option<( | |||
30 | if arg_list.args().count() > 0 { | 29 | if arg_list.args().count() > 0 { |
31 | return None; | 30 | return None; |
32 | } | 31 | } |
33 | mark::hit!(add_turbo_fish_after_call); | 32 | cov_mark::hit!(add_turbo_fish_after_call); |
34 | mark::hit!(add_type_ascription_after_call); | 33 | cov_mark::hit!(add_type_ascription_after_call); |
35 | arg_list.l_paren_token()?.prev_token().filter(|it| it.kind() == SyntaxKind::IDENT) | 34 | arg_list.l_paren_token()?.prev_token().filter(|it| it.kind() == SyntaxKind::IDENT) |
36 | })?; | 35 | })?; |
37 | let next_token = ident.next_token()?; | 36 | let next_token = ident.next_token()?; |
38 | if next_token.kind() == T![::] { | 37 | if next_token.kind() == T![::] { |
39 | mark::hit!(add_turbo_fish_one_fish_is_enough); | 38 | cov_mark::hit!(add_turbo_fish_one_fish_is_enough); |
40 | return None; | 39 | return None; |
41 | } | 40 | } |
42 | let name_ref = ast::NameRef::cast(ident.parent())?; | 41 | let name_ref = ast::NameRef::cast(ident.parent())?; |
@@ -50,7 +49,7 @@ pub(crate) fn add_turbo_fish(acc: &mut Assists, ctx: &AssistContext) -> Option<( | |||
50 | }; | 49 | }; |
51 | let generics = hir::GenericDef::Function(fun).params(ctx.sema.db); | 50 | let generics = hir::GenericDef::Function(fun).params(ctx.sema.db); |
52 | if generics.is_empty() { | 51 | if generics.is_empty() { |
53 | mark::hit!(add_turbo_fish_non_generic); | 52 | cov_mark::hit!(add_turbo_fish_non_generic); |
54 | return None; | 53 | return None; |
55 | } | 54 | } |
56 | 55 | ||
@@ -67,7 +66,7 @@ pub(crate) fn add_turbo_fish(acc: &mut Assists, ctx: &AssistContext) -> Option<( | |||
67 | }, | 66 | }, |
68 | )? | 67 | )? |
69 | } else { | 68 | } else { |
70 | mark::hit!(add_type_ascription_already_typed); | 69 | cov_mark::hit!(add_type_ascription_already_typed); |
71 | } | 70 | } |
72 | } | 71 | } |
73 | 72 | ||
@@ -87,7 +86,6 @@ mod tests { | |||
87 | use crate::tests::{check_assist, check_assist_by_label, check_assist_not_applicable}; | 86 | use crate::tests::{check_assist, check_assist_by_label, check_assist_not_applicable}; |
88 | 87 | ||
89 | use super::*; | 88 | use super::*; |
90 | use test_utils::mark; | ||
91 | 89 | ||
92 | #[test] | 90 | #[test] |
93 | fn add_turbo_fish_function() { | 91 | fn add_turbo_fish_function() { |
@@ -110,7 +108,7 @@ fn main() { | |||
110 | 108 | ||
111 | #[test] | 109 | #[test] |
112 | fn add_turbo_fish_after_call() { | 110 | fn add_turbo_fish_after_call() { |
113 | mark::check!(add_turbo_fish_after_call); | 111 | cov_mark::check!(add_turbo_fish_after_call); |
114 | check_assist( | 112 | check_assist( |
115 | add_turbo_fish, | 113 | add_turbo_fish, |
116 | r#" | 114 | r#" |
@@ -155,7 +153,7 @@ fn main() { | |||
155 | 153 | ||
156 | #[test] | 154 | #[test] |
157 | fn add_turbo_fish_one_fish_is_enough() { | 155 | fn add_turbo_fish_one_fish_is_enough() { |
158 | mark::check!(add_turbo_fish_one_fish_is_enough); | 156 | cov_mark::check!(add_turbo_fish_one_fish_is_enough); |
159 | check_assist_not_applicable( | 157 | check_assist_not_applicable( |
160 | add_turbo_fish, | 158 | add_turbo_fish, |
161 | r#" | 159 | r#" |
@@ -169,7 +167,7 @@ fn main() { | |||
169 | 167 | ||
170 | #[test] | 168 | #[test] |
171 | fn add_turbo_fish_non_generic() { | 169 | fn add_turbo_fish_non_generic() { |
172 | mark::check!(add_turbo_fish_non_generic); | 170 | cov_mark::check!(add_turbo_fish_non_generic); |
173 | check_assist_not_applicable( | 171 | check_assist_not_applicable( |
174 | add_turbo_fish, | 172 | add_turbo_fish, |
175 | r#" | 173 | r#" |
@@ -203,7 +201,7 @@ fn main() { | |||
203 | 201 | ||
204 | #[test] | 202 | #[test] |
205 | fn add_type_ascription_after_call() { | 203 | fn add_type_ascription_after_call() { |
206 | mark::check!(add_type_ascription_after_call); | 204 | cov_mark::check!(add_type_ascription_after_call); |
207 | check_assist_by_label( | 205 | check_assist_by_label( |
208 | add_turbo_fish, | 206 | add_turbo_fish, |
209 | r#" | 207 | r#" |
@@ -250,7 +248,7 @@ fn main() { | |||
250 | 248 | ||
251 | #[test] | 249 | #[test] |
252 | fn add_type_ascription_already_typed() { | 250 | fn add_type_ascription_already_typed() { |
253 | mark::check!(add_type_ascription_already_typed); | 251 | cov_mark::check!(add_type_ascription_already_typed); |
254 | check_assist( | 252 | check_assist( |
255 | add_turbo_fish, | 253 | add_turbo_fish, |
256 | r#" | 254 | r#" |
diff --git a/crates/ide_assists/src/handlers/apply_demorgan.rs b/crates/ide_assists/src/handlers/apply_demorgan.rs index 128b1eb56..a1c339603 100644 --- a/crates/ide_assists/src/handlers/apply_demorgan.rs +++ b/crates/ide_assists/src/handlers/apply_demorgan.rs | |||
@@ -1,5 +1,4 @@ | |||
1 | use syntax::ast::{self, AstNode}; | 1 | use syntax::ast::{self, AstNode}; |
2 | use test_utils::mark; | ||
3 | 2 | ||
4 | use crate::{utils::invert_boolean_expression, AssistContext, AssistId, AssistKind, Assists}; | 3 | use crate::{utils::invert_boolean_expression, AssistContext, AssistId, AssistKind, Assists}; |
5 | 4 | ||
@@ -64,10 +63,10 @@ pub(crate) fn apply_demorgan(acc: &mut Assists, ctx: &AssistContext) -> Option<( | |||
64 | edit.replace(lhs_range, not_lhs.syntax().text()); | 63 | edit.replace(lhs_range, not_lhs.syntax().text()); |
65 | edit.replace(rhs_range, not_rhs.syntax().text()); | 64 | edit.replace(rhs_range, not_rhs.syntax().text()); |
66 | if let Some(neg_expr) = neg_expr { | 65 | if let Some(neg_expr) = neg_expr { |
67 | mark::hit!(demorgan_double_negation); | 66 | cov_mark::hit!(demorgan_double_negation); |
68 | edit.replace(neg_expr.op_token().unwrap().text_range(), ""); | 67 | edit.replace(neg_expr.op_token().unwrap().text_range(), ""); |
69 | } else { | 68 | } else { |
70 | mark::hit!(demorgan_double_parens); | 69 | cov_mark::hit!(demorgan_double_parens); |
71 | edit.replace(paren_expr.l_paren_token().unwrap().text_range(), "!("); | 70 | edit.replace(paren_expr.l_paren_token().unwrap().text_range(), "!("); |
72 | } | 71 | } |
73 | } else { | 72 | } else { |
@@ -90,7 +89,6 @@ fn opposite_logic_op(kind: ast::BinOp) -> Option<&'static str> { | |||
90 | #[cfg(test)] | 89 | #[cfg(test)] |
91 | mod tests { | 90 | mod tests { |
92 | use ide_db::helpers::FamousDefs; | 91 | use ide_db::helpers::FamousDefs; |
93 | use test_utils::mark; | ||
94 | 92 | ||
95 | use super::*; | 93 | use super::*; |
96 | 94 | ||
@@ -188,13 +186,13 @@ fn f() { | |||
188 | 186 | ||
189 | #[test] | 187 | #[test] |
190 | fn demorgan_doesnt_double_negation() { | 188 | fn demorgan_doesnt_double_negation() { |
191 | mark::check!(demorgan_double_negation); | 189 | cov_mark::check!(demorgan_double_negation); |
192 | check_assist(apply_demorgan, "fn f() { !(x ||$0 x) }", "fn f() { (!x && !x) }") | 190 | check_assist(apply_demorgan, "fn f() { !(x ||$0 x) }", "fn f() { (!x && !x) }") |
193 | } | 191 | } |
194 | 192 | ||
195 | #[test] | 193 | #[test] |
196 | fn demorgan_doesnt_double_parens() { | 194 | fn demorgan_doesnt_double_parens() { |
197 | mark::check!(demorgan_double_parens); | 195 | cov_mark::check!(demorgan_double_parens); |
198 | check_assist(apply_demorgan, "fn f() { (x ||$0 x) }", "fn f() { !(!x && !x) }") | 196 | check_assist(apply_demorgan, "fn f() { (x ||$0 x) }", "fn f() { !(!x && !x) }") |
199 | } | 197 | } |
200 | } | 198 | } |
diff --git a/crates/ide_assists/src/handlers/change_visibility.rs b/crates/ide_assists/src/handlers/change_visibility.rs index ac8c44124..ec99a5505 100644 --- a/crates/ide_assists/src/handlers/change_visibility.rs +++ b/crates/ide_assists/src/handlers/change_visibility.rs | |||
@@ -4,7 +4,6 @@ use syntax::{ | |||
4 | SyntaxKind::{CONST, ENUM, FN, MODULE, STATIC, STRUCT, TRAIT, TYPE_ALIAS, VISIBILITY}, | 4 | SyntaxKind::{CONST, ENUM, FN, MODULE, STATIC, STRUCT, TRAIT, TYPE_ALIAS, VISIBILITY}, |
5 | T, | 5 | T, |
6 | }; | 6 | }; |
7 | use test_utils::mark; | ||
8 | 7 | ||
9 | use crate::{utils::vis_offset, AssistContext, AssistId, AssistKind, Assists}; | 8 | use crate::{utils::vis_offset, AssistContext, AssistId, AssistKind, Assists}; |
10 | 9 | ||
@@ -56,7 +55,7 @@ fn add_vis(acc: &mut Assists, ctx: &AssistContext) -> Option<()> { | |||
56 | } else if let Some(field_name) = ctx.find_node_at_offset::<ast::Name>() { | 55 | } else if let Some(field_name) = ctx.find_node_at_offset::<ast::Name>() { |
57 | let field = field_name.syntax().ancestors().find_map(ast::RecordField::cast)?; | 56 | let field = field_name.syntax().ancestors().find_map(ast::RecordField::cast)?; |
58 | if field.name()? != field_name { | 57 | if field.name()? != field_name { |
59 | mark::hit!(change_visibility_field_false_positive); | 58 | cov_mark::hit!(change_visibility_field_false_positive); |
60 | return None; | 59 | return None; |
61 | } | 60 | } |
62 | if field.visibility().is_some() { | 61 | if field.visibility().is_some() { |
@@ -110,8 +109,6 @@ fn change_vis(acc: &mut Assists, vis: ast::Visibility) -> Option<()> { | |||
110 | 109 | ||
111 | #[cfg(test)] | 110 | #[cfg(test)] |
112 | mod tests { | 111 | mod tests { |
113 | use test_utils::mark; | ||
114 | |||
115 | use crate::tests::{check_assist, check_assist_not_applicable, check_assist_target}; | 112 | use crate::tests::{check_assist, check_assist_not_applicable, check_assist_target}; |
116 | 113 | ||
117 | use super::*; | 114 | use super::*; |
@@ -139,7 +136,7 @@ mod tests { | |||
139 | 136 | ||
140 | #[test] | 137 | #[test] |
141 | fn change_visibility_field_false_positive() { | 138 | fn change_visibility_field_false_positive() { |
142 | mark::check!(change_visibility_field_false_positive); | 139 | cov_mark::check!(change_visibility_field_false_positive); |
143 | check_assist_not_applicable( | 140 | check_assist_not_applicable( |
144 | change_visibility, | 141 | change_visibility, |
145 | r"struct S { field: [(); { let $0x = ();}] }", | 142 | r"struct S { field: [(); { let $0x = ();}] }", |
diff --git a/crates/ide_assists/src/handlers/extract_function.rs b/crates/ide_assists/src/handlers/extract_function.rs index 8779d8bd1..dd4501709 100644 --- a/crates/ide_assists/src/handlers/extract_function.rs +++ b/crates/ide_assists/src/handlers/extract_function.rs | |||
@@ -20,7 +20,6 @@ use syntax::{ | |||
20 | SyntaxKind::{self, BLOCK_EXPR, BREAK_EXPR, COMMENT, PATH_EXPR, RETURN_EXPR}, | 20 | SyntaxKind::{self, BLOCK_EXPR, BREAK_EXPR, COMMENT, PATH_EXPR, RETURN_EXPR}, |
21 | SyntaxNode, SyntaxToken, TextRange, TextSize, TokenAtOffset, WalkEvent, T, | 21 | SyntaxNode, SyntaxToken, TextRange, TextSize, TokenAtOffset, WalkEvent, T, |
22 | }; | 22 | }; |
23 | use test_utils::mark; | ||
24 | 23 | ||
25 | use crate::{ | 24 | use crate::{ |
26 | assist_context::{AssistContext, Assists}, | 25 | assist_context::{AssistContext, Assists}, |
@@ -59,7 +58,7 @@ pub(crate) fn extract_function(acc: &mut Assists, ctx: &AssistContext) -> Option | |||
59 | 58 | ||
60 | let node = ctx.covering_element(); | 59 | let node = ctx.covering_element(); |
61 | if node.kind() == COMMENT { | 60 | if node.kind() == COMMENT { |
62 | mark::hit!(extract_function_in_comment_is_not_applicable); | 61 | cov_mark::hit!(extract_function_in_comment_is_not_applicable); |
63 | return None; | 62 | return None; |
64 | } | 63 | } |
65 | 64 | ||
@@ -197,14 +196,14 @@ fn external_control_flow(ctx: &AssistContext, body: &FunctionBody) -> Option<Con | |||
197 | if let Some(kind) = expr_err_kind(&expr, ctx) { | 196 | if let Some(kind) = expr_err_kind(&expr, ctx) { |
198 | Some(FlowKind::TryReturn { expr, kind }) | 197 | Some(FlowKind::TryReturn { expr, kind }) |
199 | } else { | 198 | } else { |
200 | mark::hit!(external_control_flow_try_and_return_non_err); | 199 | cov_mark::hit!(external_control_flow_try_and_return_non_err); |
201 | return None; | 200 | return None; |
202 | } | 201 | } |
203 | } | 202 | } |
204 | None => return None, | 203 | None => return None, |
205 | }, | 204 | }, |
206 | (Some(_), _, _, _) => { | 205 | (Some(_), _, _, _) => { |
207 | mark::hit!(external_control_flow_try_and_bc); | 206 | cov_mark::hit!(external_control_flow_try_and_bc); |
208 | return None; | 207 | return None; |
209 | } | 208 | } |
210 | (None, Some(r), None, None) => match r.expr() { | 209 | (None, Some(r), None, None) => match r.expr() { |
@@ -212,11 +211,11 @@ fn external_control_flow(ctx: &AssistContext, body: &FunctionBody) -> Option<Con | |||
212 | None => Some(FlowKind::Return), | 211 | None => Some(FlowKind::Return), |
213 | }, | 212 | }, |
214 | (None, Some(_), _, _) => { | 213 | (None, Some(_), _, _) => { |
215 | mark::hit!(external_control_flow_return_and_bc); | 214 | cov_mark::hit!(external_control_flow_return_and_bc); |
216 | return None; | 215 | return None; |
217 | } | 216 | } |
218 | (None, None, Some(_), Some(_)) => { | 217 | (None, None, Some(_), Some(_)) => { |
219 | mark::hit!(external_control_flow_break_and_continue); | 218 | cov_mark::hit!(external_control_flow_break_and_continue); |
220 | return None; | 219 | return None; |
221 | } | 220 | } |
222 | (None, None, Some(b), None) => match b.expr() { | 221 | (None, None, Some(b), None) => match b.expr() { |
@@ -1837,7 +1836,7 @@ fn $0fun_name(n: u32) -> u32 { | |||
1837 | 1836 | ||
1838 | #[test] | 1837 | #[test] |
1839 | fn in_comment_is_not_applicable() { | 1838 | fn in_comment_is_not_applicable() { |
1840 | mark::check!(extract_function_in_comment_is_not_applicable); | 1839 | cov_mark::check!(extract_function_in_comment_is_not_applicable); |
1841 | check_assist_not_applicable(extract_function, r"fn main() { 1 + /* $0comment$0 */ 1; }"); | 1840 | check_assist_not_applicable(extract_function, r"fn main() { 1 + /* $0comment$0 */ 1; }"); |
1842 | } | 1841 | } |
1843 | 1842 | ||
@@ -2822,7 +2821,7 @@ fn $0fun_name(n: i32) -> Result<i32, i64> { | |||
2822 | 2821 | ||
2823 | #[test] | 2822 | #[test] |
2824 | fn break_and_continue() { | 2823 | fn break_and_continue() { |
2825 | mark::check!(external_control_flow_break_and_continue); | 2824 | cov_mark::check!(external_control_flow_break_and_continue); |
2826 | check_assist_not_applicable( | 2825 | check_assist_not_applicable( |
2827 | extract_function, | 2826 | extract_function, |
2828 | r##" | 2827 | r##" |
@@ -2842,7 +2841,7 @@ fn foo() { | |||
2842 | 2841 | ||
2843 | #[test] | 2842 | #[test] |
2844 | fn return_and_break() { | 2843 | fn return_and_break() { |
2845 | mark::check!(external_control_flow_return_and_bc); | 2844 | cov_mark::check!(external_control_flow_return_and_bc); |
2846 | check_assist_not_applicable( | 2845 | check_assist_not_applicable( |
2847 | extract_function, | 2846 | extract_function, |
2848 | r##" | 2847 | r##" |
@@ -3341,7 +3340,7 @@ fn $0fun_name() -> Result<i32, i64> { | |||
3341 | 3340 | ||
3342 | #[test] | 3341 | #[test] |
3343 | fn try_and_break() { | 3342 | fn try_and_break() { |
3344 | mark::check!(external_control_flow_try_and_bc); | 3343 | cov_mark::check!(external_control_flow_try_and_bc); |
3345 | check_assist_not_applicable( | 3344 | check_assist_not_applicable( |
3346 | extract_function, | 3345 | extract_function, |
3347 | r##" | 3346 | r##" |
@@ -3363,7 +3362,7 @@ fn foo() -> Option<()> { | |||
3363 | 3362 | ||
3364 | #[test] | 3363 | #[test] |
3365 | fn try_and_return_ok() { | 3364 | fn try_and_return_ok() { |
3366 | mark::check!(external_control_flow_try_and_return_non_err); | 3365 | cov_mark::check!(external_control_flow_try_and_return_non_err); |
3367 | check_assist_not_applicable( | 3366 | check_assist_not_applicable( |
3368 | extract_function, | 3367 | extract_function, |
3369 | r##" | 3368 | r##" |
diff --git a/crates/ide_assists/src/handlers/extract_variable.rs b/crates/ide_assists/src/handlers/extract_variable.rs index 312ac7ac4..7a32483dc 100644 --- a/crates/ide_assists/src/handlers/extract_variable.rs +++ b/crates/ide_assists/src/handlers/extract_variable.rs | |||
@@ -6,7 +6,6 @@ use syntax::{ | |||
6 | }, | 6 | }, |
7 | SyntaxNode, | 7 | SyntaxNode, |
8 | }; | 8 | }; |
9 | use test_utils::mark; | ||
10 | 9 | ||
11 | use crate::{utils::suggest_name, AssistContext, AssistId, AssistKind, Assists}; | 10 | use crate::{utils::suggest_name, AssistContext, AssistId, AssistKind, Assists}; |
12 | 11 | ||
@@ -32,7 +31,7 @@ pub(crate) fn extract_variable(acc: &mut Assists, ctx: &AssistContext) -> Option | |||
32 | } | 31 | } |
33 | let node = ctx.covering_element(); | 32 | let node = ctx.covering_element(); |
34 | if node.kind() == COMMENT { | 33 | if node.kind() == COMMENT { |
35 | mark::hit!(extract_var_in_comment_is_not_applicable); | 34 | cov_mark::hit!(extract_var_in_comment_is_not_applicable); |
36 | return None; | 35 | return None; |
37 | } | 36 | } |
38 | let to_extract = node.ancestors().find_map(valid_target_expr)?; | 37 | let to_extract = node.ancestors().find_map(valid_target_expr)?; |
@@ -69,7 +68,7 @@ pub(crate) fn extract_variable(acc: &mut Assists, ctx: &AssistContext) -> Option | |||
69 | format_to!(buf, "{}", to_extract.syntax()); | 68 | format_to!(buf, "{}", to_extract.syntax()); |
70 | 69 | ||
71 | if let Anchor::Replace(stmt) = anchor { | 70 | if let Anchor::Replace(stmt) = anchor { |
72 | mark::hit!(test_extract_var_expr_stmt); | 71 | cov_mark::hit!(test_extract_var_expr_stmt); |
73 | if stmt.semicolon_token().is_none() { | 72 | if stmt.semicolon_token().is_none() { |
74 | buf.push_str(";"); | 73 | buf.push_str(";"); |
75 | } | 74 | } |
@@ -142,7 +141,7 @@ impl Anchor { | |||
142 | node.parent().and_then(ast::BlockExpr::cast).and_then(|it| it.tail_expr()) | 141 | node.parent().and_then(ast::BlockExpr::cast).and_then(|it| it.tail_expr()) |
143 | { | 142 | { |
144 | if expr.syntax() == &node { | 143 | if expr.syntax() == &node { |
145 | mark::hit!(test_extract_var_last_expr); | 144 | cov_mark::hit!(test_extract_var_last_expr); |
146 | return Some(Anchor::Before(node)); | 145 | return Some(Anchor::Before(node)); |
147 | } | 146 | } |
148 | } | 147 | } |
@@ -175,8 +174,6 @@ impl Anchor { | |||
175 | 174 | ||
176 | #[cfg(test)] | 175 | #[cfg(test)] |
177 | mod tests { | 176 | mod tests { |
178 | use test_utils::mark; | ||
179 | |||
180 | use crate::tests::{check_assist, check_assist_not_applicable, check_assist_target}; | 177 | use crate::tests::{check_assist, check_assist_not_applicable, check_assist_target}; |
181 | 178 | ||
182 | use super::*; | 179 | use super::*; |
@@ -199,13 +196,13 @@ fn foo() { | |||
199 | 196 | ||
200 | #[test] | 197 | #[test] |
201 | fn extract_var_in_comment_is_not_applicable() { | 198 | fn extract_var_in_comment_is_not_applicable() { |
202 | mark::check!(extract_var_in_comment_is_not_applicable); | 199 | cov_mark::check!(extract_var_in_comment_is_not_applicable); |
203 | check_assist_not_applicable(extract_variable, "fn main() { 1 + /* $0comment$0 */ 1; }"); | 200 | check_assist_not_applicable(extract_variable, "fn main() { 1 + /* $0comment$0 */ 1; }"); |
204 | } | 201 | } |
205 | 202 | ||
206 | #[test] | 203 | #[test] |
207 | fn test_extract_var_expr_stmt() { | 204 | fn test_extract_var_expr_stmt() { |
208 | mark::check!(test_extract_var_expr_stmt); | 205 | cov_mark::check!(test_extract_var_expr_stmt); |
209 | check_assist( | 206 | check_assist( |
210 | extract_variable, | 207 | extract_variable, |
211 | r#" | 208 | r#" |
@@ -250,7 +247,7 @@ fn foo() { | |||
250 | 247 | ||
251 | #[test] | 248 | #[test] |
252 | fn test_extract_var_last_expr() { | 249 | fn test_extract_var_last_expr() { |
253 | mark::check!(test_extract_var_last_expr); | 250 | cov_mark::check!(test_extract_var_last_expr); |
254 | check_assist( | 251 | check_assist( |
255 | extract_variable, | 252 | extract_variable, |
256 | r#" | 253 | r#" |
diff --git a/crates/ide_assists/src/handlers/fill_match_arms.rs b/crates/ide_assists/src/handlers/fill_match_arms.rs index 7086e47d2..878b3a3fa 100644 --- a/crates/ide_assists/src/handlers/fill_match_arms.rs +++ b/crates/ide_assists/src/handlers/fill_match_arms.rs | |||
@@ -5,7 +5,6 @@ use ide_db::helpers::{mod_path_to_ast, FamousDefs}; | |||
5 | use ide_db::RootDatabase; | 5 | use ide_db::RootDatabase; |
6 | use itertools::Itertools; | 6 | use itertools::Itertools; |
7 | use syntax::ast::{self, make, AstNode, MatchArm, NameOwner, Pat}; | 7 | use syntax::ast::{self, make, AstNode, MatchArm, NameOwner, Pat}; |
8 | use test_utils::mark; | ||
9 | 8 | ||
10 | use crate::{ | 9 | use crate::{ |
11 | utils::{does_pat_match_variant, render_snippet, Cursor}, | 10 | utils::{does_pat_match_variant, render_snippet, Cursor}, |
@@ -62,7 +61,7 @@ pub(crate) fn fill_match_arms(acc: &mut Assists, ctx: &AssistContext) -> Option< | |||
62 | .collect::<Vec<_>>(); | 61 | .collect::<Vec<_>>(); |
63 | if Some(enum_def) == FamousDefs(&ctx.sema, Some(module.krate())).core_option_Option() { | 62 | if Some(enum_def) == FamousDefs(&ctx.sema, Some(module.krate())).core_option_Option() { |
64 | // Match `Some` variant first. | 63 | // Match `Some` variant first. |
65 | mark::hit!(option_order); | 64 | cov_mark::hit!(option_order); |
66 | variants.reverse() | 65 | variants.reverse() |
67 | } | 66 | } |
68 | variants | 67 | variants |
@@ -195,7 +194,6 @@ fn build_pat(db: &RootDatabase, module: hir::Module, var: hir::Variant) -> Optio | |||
195 | #[cfg(test)] | 194 | #[cfg(test)] |
196 | mod tests { | 195 | mod tests { |
197 | use ide_db::helpers::FamousDefs; | 196 | use ide_db::helpers::FamousDefs; |
198 | use test_utils::mark; | ||
199 | 197 | ||
200 | use crate::tests::{check_assist, check_assist_not_applicable, check_assist_target}; | 198 | use crate::tests::{check_assist, check_assist_not_applicable, check_assist_target}; |
201 | 199 | ||
@@ -730,7 +728,7 @@ fn main() { | |||
730 | 728 | ||
731 | #[test] | 729 | #[test] |
732 | fn option_order() { | 730 | fn option_order() { |
733 | mark::check!(option_order); | 731 | cov_mark::check!(option_order); |
734 | let before = r#" | 732 | let before = r#" |
735 | fn foo(opt: Option<i32>) { | 733 | fn foo(opt: Option<i32>) { |
736 | match opt$0 { | 734 | match opt$0 { |
diff --git a/crates/ide_assists/src/handlers/generate_default_from_enum_variant.rs b/crates/ide_assists/src/handlers/generate_default_from_enum_variant.rs index 6a2ab9596..588ee1350 100644 --- a/crates/ide_assists/src/handlers/generate_default_from_enum_variant.rs +++ b/crates/ide_assists/src/handlers/generate_default_from_enum_variant.rs | |||
@@ -1,7 +1,6 @@ | |||
1 | use ide_db::helpers::FamousDefs; | 1 | use ide_db::helpers::FamousDefs; |
2 | use ide_db::RootDatabase; | 2 | use ide_db::RootDatabase; |
3 | use syntax::ast::{self, AstNode, NameOwner}; | 3 | use syntax::ast::{self, AstNode, NameOwner}; |
4 | use test_utils::mark; | ||
5 | 4 | ||
6 | use crate::{AssistContext, AssistId, AssistKind, Assists}; | 5 | use crate::{AssistContext, AssistId, AssistKind, Assists}; |
7 | 6 | ||
@@ -38,12 +37,12 @@ pub(crate) fn generate_default_from_enum_variant( | |||
38 | let variant_name = variant.name()?; | 37 | let variant_name = variant.name()?; |
39 | let enum_name = variant.parent_enum().name()?; | 38 | let enum_name = variant.parent_enum().name()?; |
40 | if !matches!(variant.kind(), ast::StructKind::Unit) { | 39 | if !matches!(variant.kind(), ast::StructKind::Unit) { |
41 | mark::hit!(test_gen_default_on_non_unit_variant_not_implemented); | 40 | cov_mark::hit!(test_gen_default_on_non_unit_variant_not_implemented); |
42 | return None; | 41 | return None; |
43 | } | 42 | } |
44 | 43 | ||
45 | if existing_default_impl(&ctx.sema, &variant).is_some() { | 44 | if existing_default_impl(&ctx.sema, &variant).is_some() { |
46 | mark::hit!(test_gen_default_impl_already_exists); | 45 | cov_mark::hit!(test_gen_default_impl_already_exists); |
47 | return None; | 46 | return None; |
48 | } | 47 | } |
49 | 48 | ||
@@ -89,8 +88,6 @@ fn existing_default_impl( | |||
89 | 88 | ||
90 | #[cfg(test)] | 89 | #[cfg(test)] |
91 | mod tests { | 90 | mod tests { |
92 | use test_utils::mark; | ||
93 | |||
94 | use crate::tests::{check_assist, check_assist_not_applicable}; | 91 | use crate::tests::{check_assist, check_assist_not_applicable}; |
95 | 92 | ||
96 | use super::*; | 93 | use super::*; |
@@ -127,7 +124,7 @@ impl Default for Variant { | |||
127 | 124 | ||
128 | #[test] | 125 | #[test] |
129 | fn test_generate_default_already_implemented() { | 126 | fn test_generate_default_already_implemented() { |
130 | mark::check!(test_gen_default_impl_already_exists); | 127 | cov_mark::check!(test_gen_default_impl_already_exists); |
131 | check_not_applicable( | 128 | check_not_applicable( |
132 | r#" | 129 | r#" |
133 | enum Variant { | 130 | enum Variant { |
@@ -146,7 +143,7 @@ impl Default for Variant { | |||
146 | 143 | ||
147 | #[test] | 144 | #[test] |
148 | fn test_add_from_impl_no_element() { | 145 | fn test_add_from_impl_no_element() { |
149 | mark::check!(test_gen_default_on_non_unit_variant_not_implemented); | 146 | cov_mark::check!(test_gen_default_on_non_unit_variant_not_implemented); |
150 | check_not_applicable( | 147 | check_not_applicable( |
151 | r#" | 148 | r#" |
152 | enum Variant { | 149 | enum Variant { |
diff --git a/crates/ide_assists/src/handlers/generate_default_from_new.rs b/crates/ide_assists/src/handlers/generate_default_from_new.rs index fa1254579..81c54ba3e 100644 --- a/crates/ide_assists/src/handlers/generate_default_from_new.rs +++ b/crates/ide_assists/src/handlers/generate_default_from_new.rs | |||
@@ -7,7 +7,6 @@ use syntax::{ | |||
7 | ast::{self, Impl, NameOwner}, | 7 | ast::{self, Impl, NameOwner}, |
8 | AstNode, | 8 | AstNode, |
9 | }; | 9 | }; |
10 | use test_utils::mark; | ||
11 | 10 | ||
12 | // Assist: generate_default_from_new | 11 | // Assist: generate_default_from_new |
13 | // | 12 | // |
@@ -43,19 +42,19 @@ pub(crate) fn generate_default_from_new(acc: &mut Assists, ctx: &AssistContext) | |||
43 | let fn_name = fn_node.name()?; | 42 | let fn_name = fn_node.name()?; |
44 | 43 | ||
45 | if fn_name.text() != "new" { | 44 | if fn_name.text() != "new" { |
46 | mark::hit!(other_function_than_new); | 45 | cov_mark::hit!(other_function_than_new); |
47 | return None; | 46 | return None; |
48 | } | 47 | } |
49 | 48 | ||
50 | if fn_node.param_list()?.params().next().is_some() { | 49 | if fn_node.param_list()?.params().next().is_some() { |
51 | mark::hit!(new_function_with_parameters); | 50 | cov_mark::hit!(new_function_with_parameters); |
52 | return None; | 51 | return None; |
53 | } | 52 | } |
54 | 53 | ||
55 | let impl_ = fn_node.syntax().ancestors().into_iter().find_map(ast::Impl::cast)?; | 54 | let impl_ = fn_node.syntax().ancestors().into_iter().find_map(ast::Impl::cast)?; |
56 | if is_default_implemented(ctx, &impl_) { | 55 | if is_default_implemented(ctx, &impl_) { |
57 | mark::hit!(default_block_is_already_present); | 56 | cov_mark::hit!(default_block_is_already_present); |
58 | mark::hit!(struct_in_module_with_default); | 57 | cov_mark::hit!(struct_in_module_with_default); |
59 | return None; | 58 | return None; |
60 | } | 59 | } |
61 | 60 | ||
@@ -178,7 +177,7 @@ impl Default for Test { | |||
178 | 177 | ||
179 | #[test] | 178 | #[test] |
180 | fn new_function_with_parameters() { | 179 | fn new_function_with_parameters() { |
181 | mark::check!(new_function_with_parameters); | 180 | cov_mark::check!(new_function_with_parameters); |
182 | check_not_applicable( | 181 | check_not_applicable( |
183 | r#" | 182 | r#" |
184 | struct Example { _inner: () } | 183 | struct Example { _inner: () } |
@@ -194,7 +193,7 @@ impl Example { | |||
194 | 193 | ||
195 | #[test] | 194 | #[test] |
196 | fn other_function_than_new() { | 195 | fn other_function_than_new() { |
197 | mark::check!(other_function_than_new); | 196 | cov_mark::check!(other_function_than_new); |
198 | check_not_applicable( | 197 | check_not_applicable( |
199 | r#" | 198 | r#" |
200 | struct Example { _inner: () } | 199 | struct Example { _inner: () } |
@@ -211,7 +210,7 @@ impl Example { | |||
211 | 210 | ||
212 | #[test] | 211 | #[test] |
213 | fn default_block_is_already_present() { | 212 | fn default_block_is_already_present() { |
214 | mark::check!(default_block_is_already_present); | 213 | cov_mark::check!(default_block_is_already_present); |
215 | check_not_applicable( | 214 | check_not_applicable( |
216 | r#" | 215 | r#" |
217 | struct Example { _inner: () } | 216 | struct Example { _inner: () } |
@@ -340,7 +339,7 @@ impl Default for Example { | |||
340 | 339 | ||
341 | #[test] | 340 | #[test] |
342 | fn struct_in_module_with_default() { | 341 | fn struct_in_module_with_default() { |
343 | mark::check!(struct_in_module_with_default); | 342 | cov_mark::check!(struct_in_module_with_default); |
344 | check_not_applicable( | 343 | check_not_applicable( |
345 | r#" | 344 | r#" |
346 | mod test { | 345 | mod test { |
diff --git a/crates/ide_assists/src/handlers/generate_from_impl_for_enum.rs b/crates/ide_assists/src/handlers/generate_from_impl_for_enum.rs index d9388a737..c13c6eebe 100644 --- a/crates/ide_assists/src/handlers/generate_from_impl_for_enum.rs +++ b/crates/ide_assists/src/handlers/generate_from_impl_for_enum.rs | |||
@@ -1,7 +1,6 @@ | |||
1 | use ide_db::helpers::FamousDefs; | 1 | use ide_db::helpers::FamousDefs; |
2 | use ide_db::RootDatabase; | 2 | use ide_db::RootDatabase; |
3 | use syntax::ast::{self, AstNode, NameOwner}; | 3 | use syntax::ast::{self, AstNode, NameOwner}; |
4 | use test_utils::mark; | ||
5 | 4 | ||
6 | use crate::{utils::generate_trait_impl_text, AssistContext, AssistId, AssistKind, Assists}; | 5 | use crate::{utils::generate_trait_impl_text, AssistContext, AssistId, AssistKind, Assists}; |
7 | 6 | ||
@@ -44,7 +43,7 @@ pub(crate) fn generate_from_impl_for_enum(acc: &mut Assists, ctx: &AssistContext | |||
44 | }; | 43 | }; |
45 | 44 | ||
46 | if existing_from_impl(&ctx.sema, &variant).is_some() { | 45 | if existing_from_impl(&ctx.sema, &variant).is_some() { |
47 | mark::hit!(test_add_from_impl_already_exists); | 46 | cov_mark::hit!(test_add_from_impl_already_exists); |
48 | return None; | 47 | return None; |
49 | } | 48 | } |
50 | 49 | ||
@@ -103,8 +102,6 @@ fn existing_from_impl( | |||
103 | 102 | ||
104 | #[cfg(test)] | 103 | #[cfg(test)] |
105 | mod tests { | 104 | mod tests { |
106 | use test_utils::mark; | ||
107 | |||
108 | use crate::tests::{check_assist, check_assist_not_applicable}; | 105 | use crate::tests::{check_assist, check_assist_not_applicable}; |
109 | 106 | ||
110 | use super::*; | 107 | use super::*; |
@@ -172,7 +169,7 @@ impl From<u32> for A { | |||
172 | 169 | ||
173 | #[test] | 170 | #[test] |
174 | fn test_add_from_impl_already_exists() { | 171 | fn test_add_from_impl_already_exists() { |
175 | mark::check!(test_add_from_impl_already_exists); | 172 | cov_mark::check!(test_add_from_impl_already_exists); |
176 | check_not_applicable( | 173 | check_not_applicable( |
177 | r#" | 174 | r#" |
178 | enum A { $0One(u32), } | 175 | enum A { $0One(u32), } |
diff --git a/crates/ide_assists/src/handlers/infer_function_return_type.rs b/crates/ide_assists/src/handlers/infer_function_return_type.rs index 5279af1f3..66113751c 100644 --- a/crates/ide_assists/src/handlers/infer_function_return_type.rs +++ b/crates/ide_assists/src/handlers/infer_function_return_type.rs | |||
@@ -1,6 +1,5 @@ | |||
1 | use hir::HirDisplay; | 1 | use hir::HirDisplay; |
2 | use syntax::{ast, AstNode, TextRange, TextSize}; | 2 | use syntax::{ast, AstNode, TextRange, TextSize}; |
3 | use test_utils::mark; | ||
4 | 3 | ||
5 | use crate::{AssistContext, AssistId, AssistKind, Assists}; | 4 | use crate::{AssistContext, AssistId, AssistKind, Assists}; |
6 | 5 | ||
@@ -42,7 +41,7 @@ pub(crate) fn infer_function_return_type(acc: &mut Assists, ctx: &AssistContext) | |||
42 | } | 41 | } |
43 | } | 42 | } |
44 | if let FnType::Closure { wrap_expr: true } = fn_type { | 43 | if let FnType::Closure { wrap_expr: true } = fn_type { |
45 | mark::hit!(wrap_closure_non_block_expr); | 44 | cov_mark::hit!(wrap_closure_non_block_expr); |
46 | // `|x| x` becomes `|x| -> T x` which is invalid, so wrap it in a block | 45 | // `|x| x` becomes `|x| -> T x` which is invalid, so wrap it in a block |
47 | builder.replace(tail_expr.syntax().text_range(), &format!("{{{}}}", tail_expr)); | 46 | builder.replace(tail_expr.syntax().text_range(), &format!("{{{}}}", tail_expr)); |
48 | } | 47 | } |
@@ -61,13 +60,13 @@ fn ret_ty_to_action(ret_ty: Option<ast::RetType>, insert_pos: TextSize) -> Optio | |||
61 | match ret_ty { | 60 | match ret_ty { |
62 | Some(ret_ty) => match ret_ty.ty() { | 61 | Some(ret_ty) => match ret_ty.ty() { |
63 | Some(ast::Type::InferType(_)) | None => { | 62 | Some(ast::Type::InferType(_)) | None => { |
64 | mark::hit!(existing_infer_ret_type); | 63 | cov_mark::hit!(existing_infer_ret_type); |
65 | mark::hit!(existing_infer_ret_type_closure); | 64 | cov_mark::hit!(existing_infer_ret_type_closure); |
66 | Some(InsertOrReplace::Replace(ret_ty.syntax().text_range())) | 65 | Some(InsertOrReplace::Replace(ret_ty.syntax().text_range())) |
67 | } | 66 | } |
68 | _ => { | 67 | _ => { |
69 | mark::hit!(existing_ret_type); | 68 | cov_mark::hit!(existing_ret_type); |
70 | mark::hit!(existing_ret_type_closure); | 69 | cov_mark::hit!(existing_ret_type_closure); |
71 | None | 70 | None |
72 | } | 71 | } |
73 | }, | 72 | }, |
@@ -109,11 +108,11 @@ fn extract_tail(ctx: &AssistContext) -> Option<(FnType, ast::Expr, InsertOrRepla | |||
109 | }; | 108 | }; |
110 | let frange = ctx.frange.range; | 109 | let frange = ctx.frange.range; |
111 | if return_type_range.contains_range(frange) { | 110 | if return_type_range.contains_range(frange) { |
112 | mark::hit!(cursor_in_ret_position); | 111 | cov_mark::hit!(cursor_in_ret_position); |
113 | mark::hit!(cursor_in_ret_position_closure); | 112 | cov_mark::hit!(cursor_in_ret_position_closure); |
114 | } else if tail_expr.syntax().text_range().contains_range(frange) { | 113 | } else if tail_expr.syntax().text_range().contains_range(frange) { |
115 | mark::hit!(cursor_on_tail); | 114 | cov_mark::hit!(cursor_on_tail); |
116 | mark::hit!(cursor_on_tail_closure); | 115 | cov_mark::hit!(cursor_on_tail_closure); |
117 | } else { | 116 | } else { |
118 | return None; | 117 | return None; |
119 | } | 118 | } |
@@ -128,7 +127,7 @@ mod tests { | |||
128 | 127 | ||
129 | #[test] | 128 | #[test] |
130 | fn infer_return_type_specified_inferred() { | 129 | fn infer_return_type_specified_inferred() { |
131 | mark::check!(existing_infer_ret_type); | 130 | cov_mark::check!(existing_infer_ret_type); |
132 | check_assist( | 131 | check_assist( |
133 | infer_function_return_type, | 132 | infer_function_return_type, |
134 | r#"fn foo() -> $0_ { | 133 | r#"fn foo() -> $0_ { |
@@ -142,7 +141,7 @@ mod tests { | |||
142 | 141 | ||
143 | #[test] | 142 | #[test] |
144 | fn infer_return_type_specified_inferred_closure() { | 143 | fn infer_return_type_specified_inferred_closure() { |
145 | mark::check!(existing_infer_ret_type_closure); | 144 | cov_mark::check!(existing_infer_ret_type_closure); |
146 | check_assist( | 145 | check_assist( |
147 | infer_function_return_type, | 146 | infer_function_return_type, |
148 | r#"fn foo() { | 147 | r#"fn foo() { |
@@ -156,7 +155,7 @@ mod tests { | |||
156 | 155 | ||
157 | #[test] | 156 | #[test] |
158 | fn infer_return_type_cursor_at_return_type_pos() { | 157 | fn infer_return_type_cursor_at_return_type_pos() { |
159 | mark::check!(cursor_in_ret_position); | 158 | cov_mark::check!(cursor_in_ret_position); |
160 | check_assist( | 159 | check_assist( |
161 | infer_function_return_type, | 160 | infer_function_return_type, |
162 | r#"fn foo() $0{ | 161 | r#"fn foo() $0{ |
@@ -170,7 +169,7 @@ mod tests { | |||
170 | 169 | ||
171 | #[test] | 170 | #[test] |
172 | fn infer_return_type_cursor_at_return_type_pos_closure() { | 171 | fn infer_return_type_cursor_at_return_type_pos_closure() { |
173 | mark::check!(cursor_in_ret_position_closure); | 172 | cov_mark::check!(cursor_in_ret_position_closure); |
174 | check_assist( | 173 | check_assist( |
175 | infer_function_return_type, | 174 | infer_function_return_type, |
176 | r#"fn foo() { | 175 | r#"fn foo() { |
@@ -184,7 +183,7 @@ mod tests { | |||
184 | 183 | ||
185 | #[test] | 184 | #[test] |
186 | fn infer_return_type() { | 185 | fn infer_return_type() { |
187 | mark::check!(cursor_on_tail); | 186 | cov_mark::check!(cursor_on_tail); |
188 | check_assist( | 187 | check_assist( |
189 | infer_function_return_type, | 188 | infer_function_return_type, |
190 | r#"fn foo() { | 189 | r#"fn foo() { |
@@ -219,7 +218,7 @@ mod tests { | |||
219 | 218 | ||
220 | #[test] | 219 | #[test] |
221 | fn not_applicable_ret_type_specified() { | 220 | fn not_applicable_ret_type_specified() { |
222 | mark::check!(existing_ret_type); | 221 | cov_mark::check!(existing_ret_type); |
223 | check_assist_not_applicable( | 222 | check_assist_not_applicable( |
224 | infer_function_return_type, | 223 | infer_function_return_type, |
225 | r#"fn foo() -> i32 { | 224 | r#"fn foo() -> i32 { |
@@ -251,7 +250,7 @@ mod tests { | |||
251 | 250 | ||
252 | #[test] | 251 | #[test] |
253 | fn infer_return_type_closure_block() { | 252 | fn infer_return_type_closure_block() { |
254 | mark::check!(cursor_on_tail_closure); | 253 | cov_mark::check!(cursor_on_tail_closure); |
255 | check_assist( | 254 | check_assist( |
256 | infer_function_return_type, | 255 | infer_function_return_type, |
257 | r#"fn foo() { | 256 | r#"fn foo() { |
@@ -282,7 +281,7 @@ mod tests { | |||
282 | 281 | ||
283 | #[test] | 282 | #[test] |
284 | fn infer_return_type_closure_wrap() { | 283 | fn infer_return_type_closure_wrap() { |
285 | mark::check!(wrap_closure_non_block_expr); | 284 | cov_mark::check!(wrap_closure_non_block_expr); |
286 | check_assist( | 285 | check_assist( |
287 | infer_function_return_type, | 286 | infer_function_return_type, |
288 | r#"fn foo() { | 287 | r#"fn foo() { |
@@ -321,7 +320,7 @@ mod tests { | |||
321 | 320 | ||
322 | #[test] | 321 | #[test] |
323 | fn not_applicable_ret_type_specified_closure() { | 322 | fn not_applicable_ret_type_specified_closure() { |
324 | mark::check!(existing_ret_type_closure); | 323 | cov_mark::check!(existing_ret_type_closure); |
325 | check_assist_not_applicable( | 324 | check_assist_not_applicable( |
326 | infer_function_return_type, | 325 | infer_function_return_type, |
327 | r#"fn foo() { | 326 | r#"fn foo() { |
diff --git a/crates/ide_assists/src/handlers/inline_function.rs b/crates/ide_assists/src/handlers/inline_function.rs index 6ec99b09b..8e56029cb 100644 --- a/crates/ide_assists/src/handlers/inline_function.rs +++ b/crates/ide_assists/src/handlers/inline_function.rs | |||
@@ -4,7 +4,6 @@ use syntax::{ | |||
4 | ast::{self, edit::AstNodeEdit, ArgListOwner}, | 4 | ast::{self, edit::AstNodeEdit, ArgListOwner}, |
5 | AstNode, | 5 | AstNode, |
6 | }; | 6 | }; |
7 | use test_utils::mark; | ||
8 | 7 | ||
9 | use crate::{ | 8 | use crate::{ |
10 | assist_context::{AssistContext, Assists}, | 9 | assist_context::{AssistContext, Assists}, |
@@ -49,7 +48,7 @@ pub(crate) fn inline_function(acc: &mut Assists, ctx: &AssistContext) -> Option< | |||
49 | if arguments.len() != parameters.len() { | 48 | if arguments.len() != parameters.len() { |
50 | // Can't inline the function because they've passed the wrong number of | 49 | // Can't inline the function because they've passed the wrong number of |
51 | // arguments to this function | 50 | // arguments to this function |
52 | mark::hit!(inline_function_incorrect_number_of_arguments); | 51 | cov_mark::hit!(inline_function_incorrect_number_of_arguments); |
53 | return None; | 52 | return None; |
54 | } | 53 | } |
55 | 54 | ||
@@ -155,7 +154,7 @@ fn main() { Foo.bar$0(); } | |||
155 | 154 | ||
156 | #[test] | 155 | #[test] |
157 | fn not_applicable_when_incorrect_number_of_parameters_are_provided() { | 156 | fn not_applicable_when_incorrect_number_of_parameters_are_provided() { |
158 | mark::check!(inline_function_incorrect_number_of_arguments); | 157 | cov_mark::check!(inline_function_incorrect_number_of_arguments); |
159 | check_assist_not_applicable( | 158 | check_assist_not_applicable( |
160 | inline_function, | 159 | inline_function, |
161 | r#" | 160 | r#" |
diff --git a/crates/ide_assists/src/handlers/inline_local_variable.rs b/crates/ide_assists/src/handlers/inline_local_variable.rs index da5522670..ea1466dc8 100644 --- a/crates/ide_assists/src/handlers/inline_local_variable.rs +++ b/crates/ide_assists/src/handlers/inline_local_variable.rs | |||
@@ -4,7 +4,6 @@ use syntax::{ | |||
4 | ast::{self, AstNode, AstToken}, | 4 | ast::{self, AstNode, AstToken}, |
5 | TextRange, | 5 | TextRange, |
6 | }; | 6 | }; |
7 | use test_utils::mark; | ||
8 | 7 | ||
9 | use crate::{ | 8 | use crate::{ |
10 | assist_context::{AssistContext, Assists}, | 9 | assist_context::{AssistContext, Assists}, |
@@ -34,11 +33,11 @@ pub(crate) fn inline_local_variable(acc: &mut Assists, ctx: &AssistContext) -> O | |||
34 | _ => return None, | 33 | _ => return None, |
35 | }; | 34 | }; |
36 | if bind_pat.mut_token().is_some() { | 35 | if bind_pat.mut_token().is_some() { |
37 | mark::hit!(test_not_inline_mut_variable); | 36 | cov_mark::hit!(test_not_inline_mut_variable); |
38 | return None; | 37 | return None; |
39 | } | 38 | } |
40 | if !bind_pat.syntax().text_range().contains_inclusive(ctx.offset()) { | 39 | if !bind_pat.syntax().text_range().contains_inclusive(ctx.offset()) { |
41 | mark::hit!(not_applicable_outside_of_bind_pat); | 40 | cov_mark::hit!(not_applicable_outside_of_bind_pat); |
42 | return None; | 41 | return None; |
43 | } | 42 | } |
44 | let initializer_expr = let_stmt.initializer()?; | 43 | let initializer_expr = let_stmt.initializer()?; |
@@ -47,7 +46,7 @@ pub(crate) fn inline_local_variable(acc: &mut Assists, ctx: &AssistContext) -> O | |||
47 | let def = Definition::Local(def); | 46 | let def = Definition::Local(def); |
48 | let usages = def.usages(&ctx.sema).all(); | 47 | let usages = def.usages(&ctx.sema).all(); |
49 | if usages.is_empty() { | 48 | if usages.is_empty() { |
50 | mark::hit!(test_not_applicable_if_variable_unused); | 49 | cov_mark::hit!(test_not_applicable_if_variable_unused); |
51 | return None; | 50 | return None; |
52 | }; | 51 | }; |
53 | 52 | ||
@@ -130,7 +129,7 @@ pub(crate) fn inline_local_variable(acc: &mut Assists, ctx: &AssistContext) -> O | |||
130 | Some(name_ref) | 129 | Some(name_ref) |
131 | if ast::RecordExprField::for_field_name(name_ref).is_some() => | 130 | if ast::RecordExprField::for_field_name(name_ref).is_some() => |
132 | { | 131 | { |
133 | mark::hit!(inline_field_shorthand); | 132 | cov_mark::hit!(inline_field_shorthand); |
134 | builder.insert(reference.range.end(), format!(": {}", replacement)); | 133 | builder.insert(reference.range.end(), format!(": {}", replacement)); |
135 | } | 134 | } |
136 | _ => builder.replace(reference.range, replacement), | 135 | _ => builder.replace(reference.range, replacement), |
@@ -143,8 +142,6 @@ pub(crate) fn inline_local_variable(acc: &mut Assists, ctx: &AssistContext) -> O | |||
143 | 142 | ||
144 | #[cfg(test)] | 143 | #[cfg(test)] |
145 | mod tests { | 144 | mod tests { |
146 | use test_utils::mark; | ||
147 | |||
148 | use crate::tests::{check_assist, check_assist_not_applicable}; | 145 | use crate::tests::{check_assist, check_assist_not_applicable}; |
149 | 146 | ||
150 | use super::*; | 147 | use super::*; |
@@ -351,7 +348,7 @@ fn foo() { | |||
351 | 348 | ||
352 | #[test] | 349 | #[test] |
353 | fn test_not_inline_mut_variable() { | 350 | fn test_not_inline_mut_variable() { |
354 | mark::check!(test_not_inline_mut_variable); | 351 | cov_mark::check!(test_not_inline_mut_variable); |
355 | check_assist_not_applicable( | 352 | check_assist_not_applicable( |
356 | inline_local_variable, | 353 | inline_local_variable, |
357 | r" | 354 | r" |
@@ -684,7 +681,7 @@ fn foo() { | |||
684 | 681 | ||
685 | #[test] | 682 | #[test] |
686 | fn inline_field_shorthand() { | 683 | fn inline_field_shorthand() { |
687 | mark::check!(inline_field_shorthand); | 684 | cov_mark::check!(inline_field_shorthand); |
688 | check_assist( | 685 | check_assist( |
689 | inline_local_variable, | 686 | inline_local_variable, |
690 | r" | 687 | r" |
@@ -705,7 +702,7 @@ fn main() { | |||
705 | 702 | ||
706 | #[test] | 703 | #[test] |
707 | fn test_not_applicable_if_variable_unused() { | 704 | fn test_not_applicable_if_variable_unused() { |
708 | mark::check!(test_not_applicable_if_variable_unused); | 705 | cov_mark::check!(test_not_applicable_if_variable_unused); |
709 | check_assist_not_applicable( | 706 | check_assist_not_applicable( |
710 | inline_local_variable, | 707 | inline_local_variable, |
711 | r" | 708 | r" |
@@ -718,7 +715,7 @@ fn foo() { | |||
718 | 715 | ||
719 | #[test] | 716 | #[test] |
720 | fn not_applicable_outside_of_bind_pat() { | 717 | fn not_applicable_outside_of_bind_pat() { |
721 | mark::check!(not_applicable_outside_of_bind_pat); | 718 | cov_mark::check!(not_applicable_outside_of_bind_pat); |
722 | check_assist_not_applicable( | 719 | check_assist_not_applicable( |
723 | inline_local_variable, | 720 | inline_local_variable, |
724 | r" | 721 | r" |
diff --git a/crates/ide_assists/src/handlers/move_module_to_file.rs b/crates/ide_assists/src/handlers/move_module_to_file.rs index 91c395c1b..6e685b4b2 100644 --- a/crates/ide_assists/src/handlers/move_module_to_file.rs +++ b/crates/ide_assists/src/handlers/move_module_to_file.rs | |||
@@ -5,7 +5,6 @@ use syntax::{ | |||
5 | ast::{self, edit::AstNodeEdit, NameOwner}, | 5 | ast::{self, edit::AstNodeEdit, NameOwner}, |
6 | AstNode, TextRange, | 6 | AstNode, TextRange, |
7 | }; | 7 | }; |
8 | use test_utils::mark; | ||
9 | 8 | ||
10 | use crate::{AssistContext, AssistId, AssistKind, Assists}; | 9 | use crate::{AssistContext, AssistId, AssistKind, Assists}; |
11 | 10 | ||
@@ -28,7 +27,7 @@ pub(crate) fn move_module_to_file(acc: &mut Assists, ctx: &AssistContext) -> Opt | |||
28 | 27 | ||
29 | let l_curly_offset = module_items.syntax().text_range().start(); | 28 | let l_curly_offset = module_items.syntax().text_range().start(); |
30 | if l_curly_offset <= ctx.offset() { | 29 | if l_curly_offset <= ctx.offset() { |
31 | mark::hit!(available_before_curly); | 30 | cov_mark::hit!(available_before_curly); |
32 | return None; | 31 | return None; |
33 | } | 32 | } |
34 | let target = TextRange::new(module_ast.syntax().text_range().start(), l_curly_offset); | 33 | let target = TextRange::new(module_ast.syntax().text_range().start(), l_curly_offset); |
@@ -182,7 +181,7 @@ pub(crate) mod tests; | |||
182 | 181 | ||
183 | #[test] | 182 | #[test] |
184 | fn available_before_curly() { | 183 | fn available_before_curly() { |
185 | mark::check!(available_before_curly); | 184 | cov_mark::check!(available_before_curly); |
186 | check_assist_not_applicable(move_module_to_file, r#"mod m { $0 }"#); | 185 | check_assist_not_applicable(move_module_to_file, r#"mod m { $0 }"#); |
187 | } | 186 | } |
188 | } | 187 | } |
diff --git a/crates/ide_assists/src/handlers/pull_assignment_up.rs b/crates/ide_assists/src/handlers/pull_assignment_up.rs index 377ed4f2f..04bae4e58 100644 --- a/crates/ide_assists/src/handlers/pull_assignment_up.rs +++ b/crates/ide_assists/src/handlers/pull_assignment_up.rs | |||
@@ -2,7 +2,6 @@ use syntax::{ | |||
2 | ast::{self, edit::AstNodeEdit, make}, | 2 | ast::{self, edit::AstNodeEdit, make}, |
3 | AstNode, | 3 | AstNode, |
4 | }; | 4 | }; |
5 | use test_utils::mark; | ||
6 | 5 | ||
7 | use crate::{ | 6 | use crate::{ |
8 | assist_context::{AssistContext, Assists}, | 7 | assist_context::{AssistContext, Assists}, |
@@ -104,7 +103,7 @@ fn exprify_if( | |||
104 | ast::ElseBranch::Block(exprify_block(block, sema, name)?) | 103 | ast::ElseBranch::Block(exprify_block(block, sema, name)?) |
105 | } | 104 | } |
106 | ast::ElseBranch::IfExpr(expr) => { | 105 | ast::ElseBranch::IfExpr(expr) => { |
107 | mark::hit!(test_pull_assignment_up_chained_if); | 106 | cov_mark::hit!(test_pull_assignment_up_chained_if); |
108 | ast::ElseBranch::IfExpr(ast::IfExpr::cast( | 107 | ast::ElseBranch::IfExpr(ast::IfExpr::cast( |
109 | exprify_if(&expr, sema, name)?.syntax().to_owned(), | 108 | exprify_if(&expr, sema, name)?.syntax().to_owned(), |
110 | )?) | 109 | )?) |
@@ -144,7 +143,7 @@ fn is_equivalent( | |||
144 | ) -> bool { | 143 | ) -> bool { |
145 | match (expr0, expr1) { | 144 | match (expr0, expr1) { |
146 | (ast::Expr::FieldExpr(field_expr0), ast::Expr::FieldExpr(field_expr1)) => { | 145 | (ast::Expr::FieldExpr(field_expr0), ast::Expr::FieldExpr(field_expr1)) => { |
147 | mark::hit!(test_pull_assignment_up_field_assignment); | 146 | cov_mark::hit!(test_pull_assignment_up_field_assignment); |
148 | sema.resolve_field(field_expr0) == sema.resolve_field(field_expr1) | 147 | sema.resolve_field(field_expr0) == sema.resolve_field(field_expr1) |
149 | } | 148 | } |
150 | (ast::Expr::PathExpr(path0), ast::Expr::PathExpr(path1)) => { | 149 | (ast::Expr::PathExpr(path0), ast::Expr::PathExpr(path1)) => { |
@@ -160,7 +159,7 @@ fn is_equivalent( | |||
160 | if prefix0.op_kind() == Some(ast::PrefixOp::Deref) | 159 | if prefix0.op_kind() == Some(ast::PrefixOp::Deref) |
161 | && prefix1.op_kind() == Some(ast::PrefixOp::Deref) => | 160 | && prefix1.op_kind() == Some(ast::PrefixOp::Deref) => |
162 | { | 161 | { |
163 | mark::hit!(test_pull_assignment_up_deref); | 162 | cov_mark::hit!(test_pull_assignment_up_deref); |
164 | if let (Some(prefix0), Some(prefix1)) = (prefix0.expr(), prefix1.expr()) { | 163 | if let (Some(prefix0), Some(prefix1)) = (prefix0.expr(), prefix1.expr()) { |
165 | is_equivalent(sema, &prefix0, &prefix1) | 164 | is_equivalent(sema, &prefix0, &prefix1) |
166 | } else { | 165 | } else { |
@@ -263,7 +262,7 @@ fn foo() { | |||
263 | 262 | ||
264 | #[test] | 263 | #[test] |
265 | fn test_pull_assignment_up_chained_if() { | 264 | fn test_pull_assignment_up_chained_if() { |
266 | mark::check!(test_pull_assignment_up_chained_if); | 265 | cov_mark::check!(test_pull_assignment_up_chained_if); |
267 | check_assist( | 266 | check_assist( |
268 | pull_assignment_up, | 267 | pull_assignment_up, |
269 | r#" | 268 | r#" |
@@ -379,7 +378,7 @@ fn foo() { | |||
379 | 378 | ||
380 | #[test] | 379 | #[test] |
381 | fn test_pull_assignment_up_field_assignment() { | 380 | fn test_pull_assignment_up_field_assignment() { |
382 | mark::check!(test_pull_assignment_up_field_assignment); | 381 | cov_mark::check!(test_pull_assignment_up_field_assignment); |
383 | check_assist( | 382 | check_assist( |
384 | pull_assignment_up, | 383 | pull_assignment_up, |
385 | r#" | 384 | r#" |
@@ -411,7 +410,7 @@ fn foo() { | |||
411 | 410 | ||
412 | #[test] | 411 | #[test] |
413 | fn test_pull_assignment_up_deref() { | 412 | fn test_pull_assignment_up_deref() { |
414 | mark::check!(test_pull_assignment_up_deref); | 413 | cov_mark::check!(test_pull_assignment_up_deref); |
415 | check_assist( | 414 | check_assist( |
416 | pull_assignment_up, | 415 | pull_assignment_up, |
417 | r#" | 416 | r#" |
diff --git a/crates/ide_assists/src/handlers/qualify_path.rs b/crates/ide_assists/src/handlers/qualify_path.rs index d84ca0e55..d3e34e540 100644 --- a/crates/ide_assists/src/handlers/qualify_path.rs +++ b/crates/ide_assists/src/handlers/qualify_path.rs | |||
@@ -8,7 +8,6 @@ use syntax::{ | |||
8 | ast::{make, ArgListOwner}, | 8 | ast::{make, ArgListOwner}, |
9 | AstNode, | 9 | AstNode, |
10 | }; | 10 | }; |
11 | use test_utils::mark; | ||
12 | 11 | ||
13 | use crate::{ | 12 | use crate::{ |
14 | assist_context::{AssistContext, Assists}, | 13 | assist_context::{AssistContext, Assists}, |
@@ -47,25 +46,25 @@ pub(crate) fn qualify_path(acc: &mut Assists, ctx: &AssistContext) -> Option<()> | |||
47 | let qualify_candidate = match candidate { | 46 | let qualify_candidate = match candidate { |
48 | ImportCandidate::Path(candidate) => { | 47 | ImportCandidate::Path(candidate) => { |
49 | if candidate.qualifier.is_some() { | 48 | if candidate.qualifier.is_some() { |
50 | mark::hit!(qualify_path_qualifier_start); | 49 | cov_mark::hit!(qualify_path_qualifier_start); |
51 | let path = ast::Path::cast(syntax_under_caret)?; | 50 | let path = ast::Path::cast(syntax_under_caret)?; |
52 | let (prev_segment, segment) = (path.qualifier()?.segment()?, path.segment()?); | 51 | let (prev_segment, segment) = (path.qualifier()?.segment()?, path.segment()?); |
53 | QualifyCandidate::QualifierStart(segment, prev_segment.generic_arg_list()) | 52 | QualifyCandidate::QualifierStart(segment, prev_segment.generic_arg_list()) |
54 | } else { | 53 | } else { |
55 | mark::hit!(qualify_path_unqualified_name); | 54 | cov_mark::hit!(qualify_path_unqualified_name); |
56 | let path = ast::Path::cast(syntax_under_caret)?; | 55 | let path = ast::Path::cast(syntax_under_caret)?; |
57 | let generics = path.segment()?.generic_arg_list(); | 56 | let generics = path.segment()?.generic_arg_list(); |
58 | QualifyCandidate::UnqualifiedName(generics) | 57 | QualifyCandidate::UnqualifiedName(generics) |
59 | } | 58 | } |
60 | } | 59 | } |
61 | ImportCandidate::TraitAssocItem(_) => { | 60 | ImportCandidate::TraitAssocItem(_) => { |
62 | mark::hit!(qualify_path_trait_assoc_item); | 61 | cov_mark::hit!(qualify_path_trait_assoc_item); |
63 | let path = ast::Path::cast(syntax_under_caret)?; | 62 | let path = ast::Path::cast(syntax_under_caret)?; |
64 | let (qualifier, segment) = (path.qualifier()?, path.segment()?); | 63 | let (qualifier, segment) = (path.qualifier()?, path.segment()?); |
65 | QualifyCandidate::TraitAssocItem(qualifier, segment) | 64 | QualifyCandidate::TraitAssocItem(qualifier, segment) |
66 | } | 65 | } |
67 | ImportCandidate::TraitMethod(_) => { | 66 | ImportCandidate::TraitMethod(_) => { |
68 | mark::hit!(qualify_path_trait_method); | 67 | cov_mark::hit!(qualify_path_trait_method); |
69 | let mcall_expr = ast::MethodCallExpr::cast(syntax_under_caret)?; | 68 | let mcall_expr = ast::MethodCallExpr::cast(syntax_under_caret)?; |
70 | QualifyCandidate::TraitMethod(ctx.sema.db, mcall_expr) | 69 | QualifyCandidate::TraitMethod(ctx.sema.db, mcall_expr) |
71 | } | 70 | } |
@@ -212,7 +211,7 @@ mod tests { | |||
212 | 211 | ||
213 | #[test] | 212 | #[test] |
214 | fn applicable_when_found_an_import_partial() { | 213 | fn applicable_when_found_an_import_partial() { |
215 | mark::check!(qualify_path_unqualified_name); | 214 | cov_mark::check!(qualify_path_unqualified_name); |
216 | check_assist( | 215 | check_assist( |
217 | qualify_path, | 216 | qualify_path, |
218 | r" | 217 | r" |
@@ -504,7 +503,7 @@ fn main() { | |||
504 | 503 | ||
505 | #[test] | 504 | #[test] |
506 | fn associated_struct_const() { | 505 | fn associated_struct_const() { |
507 | mark::check!(qualify_path_qualifier_start); | 506 | cov_mark::check!(qualify_path_qualifier_start); |
508 | check_assist( | 507 | check_assist( |
509 | qualify_path, | 508 | qualify_path, |
510 | r" | 509 | r" |
@@ -605,7 +604,7 @@ fn main() { | |||
605 | 604 | ||
606 | #[test] | 605 | #[test] |
607 | fn associated_trait_const() { | 606 | fn associated_trait_const() { |
608 | mark::check!(qualify_path_trait_assoc_item); | 607 | cov_mark::check!(qualify_path_trait_assoc_item); |
609 | check_assist( | 608 | check_assist( |
610 | qualify_path, | 609 | qualify_path, |
611 | r" | 610 | r" |
@@ -675,7 +674,7 @@ fn main() { | |||
675 | 674 | ||
676 | #[test] | 675 | #[test] |
677 | fn trait_method() { | 676 | fn trait_method() { |
678 | mark::check!(qualify_path_trait_method); | 677 | cov_mark::check!(qualify_path_trait_method); |
679 | check_assist( | 678 | check_assist( |
680 | qualify_path, | 679 | qualify_path, |
681 | r" | 680 | r" |
diff --git a/crates/ide_assists/src/handlers/raw_string.rs b/crates/ide_assists/src/handlers/raw_string.rs index d95267607..d0f1613f3 100644 --- a/crates/ide_assists/src/handlers/raw_string.rs +++ b/crates/ide_assists/src/handlers/raw_string.rs | |||
@@ -1,7 +1,6 @@ | |||
1 | use std::borrow::Cow; | 1 | use std::borrow::Cow; |
2 | 2 | ||
3 | use syntax::{ast, AstToken, TextRange, TextSize}; | 3 | use syntax::{ast, AstToken, TextRange, TextSize}; |
4 | use test_utils::mark; | ||
5 | 4 | ||
6 | use crate::{AssistContext, AssistId, AssistKind, Assists}; | 5 | use crate::{AssistContext, AssistId, AssistKind, Assists}; |
7 | 6 | ||
@@ -149,7 +148,7 @@ pub(crate) fn remove_hash(acc: &mut Assists, ctx: &AssistContext) -> Option<()> | |||
149 | let internal_text = &text[token.text_range_between_quotes()? - text_range.start()]; | 148 | let internal_text = &text[token.text_range_between_quotes()? - text_range.start()]; |
150 | 149 | ||
151 | if existing_hashes == required_hashes(internal_text) { | 150 | if existing_hashes == required_hashes(internal_text) { |
152 | mark::hit!(cant_remove_required_hash); | 151 | cov_mark::hit!(cant_remove_required_hash); |
153 | return None; | 152 | return None; |
154 | } | 153 | } |
155 | 154 | ||
@@ -182,8 +181,6 @@ fn test_required_hashes() { | |||
182 | 181 | ||
183 | #[cfg(test)] | 182 | #[cfg(test)] |
184 | mod tests { | 183 | mod tests { |
185 | use test_utils::mark; | ||
186 | |||
187 | use crate::tests::{check_assist, check_assist_not_applicable, check_assist_target}; | 184 | use crate::tests::{check_assist, check_assist_not_applicable, check_assist_target}; |
188 | 185 | ||
189 | use super::*; | 186 | use super::*; |
@@ -396,7 +393,7 @@ string"###; | |||
396 | 393 | ||
397 | #[test] | 394 | #[test] |
398 | fn cant_remove_required_hash() { | 395 | fn cant_remove_required_hash() { |
399 | mark::check!(cant_remove_required_hash); | 396 | cov_mark::check!(cant_remove_required_hash); |
400 | check_assist_not_applicable( | 397 | check_assist_not_applicable( |
401 | remove_hash, | 398 | remove_hash, |
402 | r##" | 399 | r##" |
diff --git a/crates/ide_assists/src/handlers/remove_unused_param.rs b/crates/ide_assists/src/handlers/remove_unused_param.rs index c961680e2..2699d2861 100644 --- a/crates/ide_assists/src/handlers/remove_unused_param.rs +++ b/crates/ide_assists/src/handlers/remove_unused_param.rs | |||
@@ -4,7 +4,7 @@ use syntax::{ | |||
4 | ast::{self, ArgListOwner}, | 4 | ast::{self, ArgListOwner}, |
5 | AstNode, SourceFile, SyntaxKind, SyntaxNode, TextRange, T, | 5 | AstNode, SourceFile, SyntaxKind, SyntaxNode, TextRange, T, |
6 | }; | 6 | }; |
7 | use test_utils::mark; | 7 | |
8 | use SyntaxKind::WHITESPACE; | 8 | use SyntaxKind::WHITESPACE; |
9 | 9 | ||
10 | use crate::{ | 10 | use crate::{ |
@@ -49,7 +49,7 @@ pub(crate) fn remove_unused_param(acc: &mut Assists, ctx: &AssistContext) -> Opt | |||
49 | Definition::Local(local) | 49 | Definition::Local(local) |
50 | }; | 50 | }; |
51 | if param_def.usages(&ctx.sema).at_least_one() { | 51 | if param_def.usages(&ctx.sema).at_least_one() { |
52 | mark::hit!(keep_used); | 52 | cov_mark::hit!(keep_used); |
53 | return None; | 53 | return None; |
54 | } | 54 | } |
55 | acc.add( | 55 | acc.add( |
@@ -243,7 +243,7 @@ fn b2() { foo(9) } | |||
243 | 243 | ||
244 | #[test] | 244 | #[test] |
245 | fn keep_used() { | 245 | fn keep_used() { |
246 | mark::check!(keep_used); | 246 | cov_mark::check!(keep_used); |
247 | check_assist_not_applicable( | 247 | check_assist_not_applicable( |
248 | remove_unused_param, | 248 | remove_unused_param, |
249 | r#" | 249 | r#" |
diff --git a/crates/ide_assists/src/handlers/reorder_fields.rs b/crates/ide_assists/src/handlers/reorder_fields.rs index fba7d6ddb..794c89323 100644 --- a/crates/ide_assists/src/handlers/reorder_fields.rs +++ b/crates/ide_assists/src/handlers/reorder_fields.rs | |||
@@ -4,7 +4,6 @@ use rustc_hash::FxHashMap; | |||
4 | use hir::{Adt, ModuleDef, PathResolution, Semantics, Struct}; | 4 | use hir::{Adt, ModuleDef, PathResolution, Semantics, Struct}; |
5 | use ide_db::RootDatabase; | 5 | use ide_db::RootDatabase; |
6 | use syntax::{algo, ast, match_ast, AstNode, SyntaxKind, SyntaxKind::*, SyntaxNode}; | 6 | use syntax::{algo, ast, match_ast, AstNode, SyntaxKind, SyntaxKind::*, SyntaxNode}; |
7 | use test_utils::mark; | ||
8 | 7 | ||
9 | use crate::{AssistContext, AssistId, AssistKind, Assists}; | 8 | use crate::{AssistContext, AssistId, AssistKind, Assists}; |
10 | 9 | ||
@@ -39,7 +38,7 @@ fn reorder<R: AstNode>(acc: &mut Assists, ctx: &AssistContext) -> Option<()> { | |||
39 | }); | 38 | }); |
40 | 39 | ||
41 | if sorted_fields == fields { | 40 | if sorted_fields == fields { |
42 | mark::hit!(reorder_sorted_fields); | 41 | cov_mark::hit!(reorder_sorted_fields); |
43 | return None; | 42 | return None; |
44 | } | 43 | } |
45 | 44 | ||
@@ -109,15 +108,13 @@ fn compute_fields_ranks(path: &ast::Path, ctx: &AssistContext) -> Option<FxHashM | |||
109 | 108 | ||
110 | #[cfg(test)] | 109 | #[cfg(test)] |
111 | mod tests { | 110 | mod tests { |
112 | use test_utils::mark; | ||
113 | |||
114 | use crate::tests::{check_assist, check_assist_not_applicable}; | 111 | use crate::tests::{check_assist, check_assist_not_applicable}; |
115 | 112 | ||
116 | use super::*; | 113 | use super::*; |
117 | 114 | ||
118 | #[test] | 115 | #[test] |
119 | fn reorder_sorted_fields() { | 116 | fn reorder_sorted_fields() { |
120 | mark::check!(reorder_sorted_fields); | 117 | cov_mark::check!(reorder_sorted_fields); |
121 | check_assist_not_applicable( | 118 | check_assist_not_applicable( |
122 | reorder_fields, | 119 | reorder_fields, |
123 | r#" | 120 | r#" |
diff --git a/crates/ide_assists/src/handlers/reorder_impl.rs b/crates/ide_assists/src/handlers/reorder_impl.rs index 309f291c8..edf4b0bfe 100644 --- a/crates/ide_assists/src/handlers/reorder_impl.rs +++ b/crates/ide_assists/src/handlers/reorder_impl.rs | |||
@@ -8,7 +8,6 @@ use syntax::{ | |||
8 | ast::{self, NameOwner}, | 8 | ast::{self, NameOwner}, |
9 | AstNode, | 9 | AstNode, |
10 | }; | 10 | }; |
11 | use test_utils::mark; | ||
12 | 11 | ||
13 | use crate::{AssistContext, AssistId, AssistKind, Assists}; | 12 | use crate::{AssistContext, AssistId, AssistKind, Assists}; |
14 | 13 | ||
@@ -71,7 +70,7 @@ pub(crate) fn reorder_impl(acc: &mut Assists, ctx: &AssistContext) -> Option<()> | |||
71 | 70 | ||
72 | // Don't edit already sorted methods: | 71 | // Don't edit already sorted methods: |
73 | if methods == sorted { | 72 | if methods == sorted { |
74 | mark::hit!(not_applicable_if_sorted); | 73 | cov_mark::hit!(not_applicable_if_sorted); |
75 | return None; | 74 | return None; |
76 | } | 75 | } |
77 | 76 | ||
@@ -121,15 +120,13 @@ fn get_methods(items: &ast::AssocItemList) -> Vec<ast::Fn> { | |||
121 | 120 | ||
122 | #[cfg(test)] | 121 | #[cfg(test)] |
123 | mod tests { | 122 | mod tests { |
124 | use test_utils::mark; | ||
125 | |||
126 | use crate::tests::{check_assist, check_assist_not_applicable}; | 123 | use crate::tests::{check_assist, check_assist_not_applicable}; |
127 | 124 | ||
128 | use super::*; | 125 | use super::*; |
129 | 126 | ||
130 | #[test] | 127 | #[test] |
131 | fn not_applicable_if_sorted() { | 128 | fn not_applicable_if_sorted() { |
132 | mark::check!(not_applicable_if_sorted); | 129 | cov_mark::check!(not_applicable_if_sorted); |
133 | check_assist_not_applicable( | 130 | check_assist_not_applicable( |
134 | reorder_impl, | 131 | reorder_impl, |
135 | r#" | 132 | r#" |
diff --git a/crates/ide_assists/src/handlers/replace_for_loop_with_for_each.rs b/crates/ide_assists/src/handlers/replace_for_loop_with_for_each.rs index 27da28bc0..50b05ab0b 100644 --- a/crates/ide_assists/src/handlers/replace_for_loop_with_for_each.rs +++ b/crates/ide_assists/src/handlers/replace_for_loop_with_for_each.rs | |||
@@ -3,7 +3,6 @@ use hir::known; | |||
3 | use ide_db::helpers::FamousDefs; | 3 | use ide_db::helpers::FamousDefs; |
4 | use stdx::format_to; | 4 | use stdx::format_to; |
5 | use syntax::{ast, AstNode}; | 5 | use syntax::{ast, AstNode}; |
6 | use test_utils::mark; | ||
7 | 6 | ||
8 | use crate::{AssistContext, AssistId, AssistKind, Assists}; | 7 | use crate::{AssistContext, AssistId, AssistKind, Assists}; |
9 | 8 | ||
@@ -34,7 +33,7 @@ pub(crate) fn replace_for_loop_with_for_each(acc: &mut Assists, ctx: &AssistCont | |||
34 | let pat = for_loop.pat()?; | 33 | let pat = for_loop.pat()?; |
35 | let body = for_loop.loop_body()?; | 34 | let body = for_loop.loop_body()?; |
36 | if body.syntax().text_range().start() < ctx.offset() { | 35 | if body.syntax().text_range().start() < ctx.offset() { |
37 | mark::hit!(not_available_in_body); | 36 | cov_mark::hit!(not_available_in_body); |
38 | return None; | 37 | return None; |
39 | } | 38 | } |
40 | 39 | ||
@@ -187,7 +186,7 @@ fn main() { | |||
187 | 186 | ||
188 | #[test] | 187 | #[test] |
189 | fn not_available_in_body() { | 188 | fn not_available_in_body() { |
190 | mark::check!(not_available_in_body); | 189 | cov_mark::check!(not_available_in_body); |
191 | check_assist_not_applicable( | 190 | check_assist_not_applicable( |
192 | replace_for_loop_with_for_each, | 191 | replace_for_loop_with_for_each, |
193 | r" | 192 | r" |
diff --git a/crates/ide_assists/src/handlers/replace_qualified_name_with_use.rs b/crates/ide_assists/src/handlers/replace_qualified_name_with_use.rs index 55481af34..36d2e0331 100644 --- a/crates/ide_assists/src/handlers/replace_qualified_name_with_use.rs +++ b/crates/ide_assists/src/handlers/replace_qualified_name_with_use.rs | |||
@@ -1,6 +1,5 @@ | |||
1 | use ide_db::helpers::insert_use::{insert_use, ImportScope}; | 1 | use ide_db::helpers::insert_use::{insert_use, ImportScope}; |
2 | use syntax::{algo::SyntaxRewriter, ast, match_ast, AstNode, SyntaxNode}; | 2 | use syntax::{algo::SyntaxRewriter, ast, match_ast, AstNode, SyntaxNode}; |
3 | use test_utils::mark; | ||
4 | 3 | ||
5 | use crate::{AssistContext, AssistId, AssistKind, Assists}; | 4 | use crate::{AssistContext, AssistId, AssistKind, Assists}; |
6 | 5 | ||
@@ -27,7 +26,7 @@ pub(crate) fn replace_qualified_name_with_use( | |||
27 | return None; | 26 | return None; |
28 | } | 27 | } |
29 | if path.qualifier().is_none() { | 28 | if path.qualifier().is_none() { |
30 | mark::hit!(dont_import_trivial_paths); | 29 | cov_mark::hit!(dont_import_trivial_paths); |
31 | return None; | 30 | return None; |
32 | } | 31 | } |
33 | 32 | ||
@@ -458,7 +457,7 @@ impl Debug for Foo { | |||
458 | 457 | ||
459 | #[test] | 458 | #[test] |
460 | fn dont_import_trivial_paths() { | 459 | fn dont_import_trivial_paths() { |
461 | mark::check!(dont_import_trivial_paths); | 460 | cov_mark::check!(dont_import_trivial_paths); |
462 | check_assist_not_applicable( | 461 | check_assist_not_applicable( |
463 | replace_qualified_name_with_use, | 462 | replace_qualified_name_with_use, |
464 | r" | 463 | r" |
diff --git a/crates/ide_assists/src/handlers/unmerge_use.rs b/crates/ide_assists/src/handlers/unmerge_use.rs index 3dbef8e51..616af7c2e 100644 --- a/crates/ide_assists/src/handlers/unmerge_use.rs +++ b/crates/ide_assists/src/handlers/unmerge_use.rs | |||
@@ -3,7 +3,6 @@ use syntax::{ | |||
3 | ast::{self, edit::AstNodeEdit, VisibilityOwner}, | 3 | ast::{self, edit::AstNodeEdit, VisibilityOwner}, |
4 | AstNode, SyntaxKind, | 4 | AstNode, SyntaxKind, |
5 | }; | 5 | }; |
6 | use test_utils::mark; | ||
7 | 6 | ||
8 | use crate::{ | 7 | use crate::{ |
9 | assist_context::{AssistContext, Assists}, | 8 | assist_context::{AssistContext, Assists}, |
@@ -27,7 +26,7 @@ pub(crate) fn unmerge_use(acc: &mut Assists, ctx: &AssistContext) -> Option<()> | |||
27 | 26 | ||
28 | let tree_list = tree.syntax().parent().and_then(ast::UseTreeList::cast)?; | 27 | let tree_list = tree.syntax().parent().and_then(ast::UseTreeList::cast)?; |
29 | if tree_list.use_trees().count() < 2 { | 28 | if tree_list.use_trees().count() < 2 { |
30 | mark::hit!(skip_single_use_item); | 29 | cov_mark::hit!(skip_single_use_item); |
31 | return None; | 30 | return None; |
32 | } | 31 | } |
33 | 32 | ||