diff options
Diffstat (limited to 'crates/ide_assists/src/handlers/generate_default_from_new.rs')
-rw-r--r-- | crates/ide_assists/src/handlers/generate_default_from_new.rs | 17 |
1 files changed, 8 insertions, 9 deletions
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 { |