diff options
Diffstat (limited to 'crates/ide_assists/src/handlers/extract_variable.rs')
-rw-r--r-- | crates/ide_assists/src/handlers/extract_variable.rs | 15 |
1 files changed, 6 insertions, 9 deletions
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#" |