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