diff options
author | bors[bot] <26634292+bors[bot]@users.noreply.github.com> | 2021-03-08 21:19:31 +0000 |
---|---|---|
committer | GitHub <[email protected]> | 2021-03-08 21:19:31 +0000 |
commit | c48478621fe9b50cb19bfd0ea4a5c2ff0de5d6ac (patch) | |
tree | 3905029a42c8bb6c5d363753b34cd6b5dd43f4d5 /crates/ide | |
parent | c5189a22ccf4c28e309e4189defbb88b83bb2aea (diff) | |
parent | fc9eed4836dfc88fe2893c81b015ab440cea2ba6 (diff) |
Merge #7924
7924: Use upstream cov-mark r=matklad a=lnicola
Closes #7922
But doesn't remove any dependency, unfortunately.
Co-authored-by: Laurențiu Nicola <[email protected]>
Diffstat (limited to 'crates/ide')
-rw-r--r-- | crates/ide/Cargo.toml | 1 | ||||
-rw-r--r-- | crates/ide/src/hover.rs | 9 | ||||
-rw-r--r-- | crates/ide/src/join_lines.rs | 8 | ||||
-rw-r--r-- | crates/ide/src/matching_brace.rs | 5 | ||||
-rw-r--r-- | crates/ide/src/parent_module.rs | 6 | ||||
-rw-r--r-- | crates/ide/src/references/rename.rs | 58 | ||||
-rw-r--r-- | crates/ide/src/runnables.rs | 8 | ||||
-rw-r--r-- | crates/ide/src/typing/on_enter.rs | 8 |
8 files changed, 51 insertions, 52 deletions
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() { |