aboutsummaryrefslogtreecommitdiff
path: root/crates/ra_assists/src/handlers/introduce_variable.rs
diff options
context:
space:
mode:
Diffstat (limited to 'crates/ra_assists/src/handlers/introduce_variable.rs')
-rw-r--r--crates/ra_assists/src/handlers/introduce_variable.rs16
1 files changed, 8 insertions, 8 deletions
diff --git a/crates/ra_assists/src/handlers/introduce_variable.rs b/crates/ra_assists/src/handlers/introduce_variable.rs
index fdf3ada0d..56c610fed 100644
--- a/crates/ra_assists/src/handlers/introduce_variable.rs
+++ b/crates/ra_assists/src/handlers/introduce_variable.rs
@@ -7,7 +7,7 @@ use ra_syntax::{
7 SyntaxNode, TextSize, 7 SyntaxNode, TextSize,
8}; 8};
9use stdx::format_to; 9use stdx::format_to;
10use test_utils::tested_by; 10use test_utils::mark;
11 11
12use crate::{AssistContext, AssistId, Assists}; 12use crate::{AssistContext, AssistId, Assists};
13 13
@@ -33,7 +33,7 @@ pub(crate) fn introduce_variable(acc: &mut Assists, ctx: &AssistContext) -> Opti
33 } 33 }
34 let node = ctx.covering_element(); 34 let node = ctx.covering_element();
35 if node.kind() == COMMENT { 35 if node.kind() == COMMENT {
36 tested_by!(introduce_var_in_comment_is_not_applicable); 36 mark::hit!(introduce_var_in_comment_is_not_applicable);
37 return None; 37 return None;
38 } 38 }
39 let expr = node.ancestors().find_map(valid_target_expr)?; 39 let expr = node.ancestors().find_map(valid_target_expr)?;
@@ -61,7 +61,7 @@ pub(crate) fn introduce_variable(acc: &mut Assists, ctx: &AssistContext) -> Opti
61 false 61 false
62 }; 62 };
63 if is_full_stmt { 63 if is_full_stmt {
64 tested_by!(test_introduce_var_expr_stmt); 64 mark::hit!(test_introduce_var_expr_stmt);
65 if full_stmt.unwrap().semicolon_token().is_none() { 65 if full_stmt.unwrap().semicolon_token().is_none() {
66 buf.push_str(";"); 66 buf.push_str(";");
67 } 67 }
@@ -113,7 +113,7 @@ fn anchor_stmt(expr: ast::Expr) -> Option<(SyntaxNode, bool)> {
113 expr.syntax().ancestors().find_map(|node| { 113 expr.syntax().ancestors().find_map(|node| {
114 if let Some(expr) = node.parent().and_then(ast::BlockExpr::cast).and_then(|it| it.expr()) { 114 if let Some(expr) = node.parent().and_then(ast::BlockExpr::cast).and_then(|it| it.expr()) {
115 if expr.syntax() == &node { 115 if expr.syntax() == &node {
116 tested_by!(test_introduce_var_last_expr); 116 mark::hit!(test_introduce_var_last_expr);
117 return Some((node, false)); 117 return Some((node, false));
118 } 118 }
119 } 119 }
@@ -134,7 +134,7 @@ fn anchor_stmt(expr: ast::Expr) -> Option<(SyntaxNode, bool)> {
134 134
135#[cfg(test)] 135#[cfg(test)]
136mod tests { 136mod tests {
137 use test_utils::covers; 137 use test_utils::mark;
138 138
139 use crate::tests::{check_assist, check_assist_not_applicable, check_assist_target}; 139 use crate::tests::{check_assist, check_assist_not_applicable, check_assist_target};
140 140
@@ -158,13 +158,13 @@ fn foo() {
158 158
159 #[test] 159 #[test]
160 fn introduce_var_in_comment_is_not_applicable() { 160 fn introduce_var_in_comment_is_not_applicable() {
161 covers!(introduce_var_in_comment_is_not_applicable); 161 mark::check!(introduce_var_in_comment_is_not_applicable);
162 check_assist_not_applicable(introduce_variable, "fn main() { 1 + /* <|>comment<|> */ 1; }"); 162 check_assist_not_applicable(introduce_variable, "fn main() { 1 + /* <|>comment<|> */ 1; }");
163 } 163 }
164 164
165 #[test] 165 #[test]
166 fn test_introduce_var_expr_stmt() { 166 fn test_introduce_var_expr_stmt() {
167 covers!(test_introduce_var_expr_stmt); 167 mark::check!(test_introduce_var_expr_stmt);
168 check_assist( 168 check_assist(
169 introduce_variable, 169 introduce_variable,
170 " 170 "
@@ -209,7 +209,7 @@ fn foo() {
209 209
210 #[test] 210 #[test]
211 fn test_introduce_var_last_expr() { 211 fn test_introduce_var_last_expr() {
212 covers!(test_introduce_var_last_expr); 212 mark::check!(test_introduce_var_last_expr);
213 check_assist( 213 check_assist(
214 introduce_variable, 214 introduce_variable,
215 " 215 "