diff options
author | Aleksey Kladov <[email protected]> | 2020-05-19 23:19:59 +0100 |
---|---|---|
committer | Aleksey Kladov <[email protected]> | 2020-05-20 12:00:50 +0100 |
commit | d18d1c05949eaa890e7bb75710816a61b09a93dd (patch) | |
tree | be16530829a82a839a02bef0983bbc520e074579 /crates/ra_assists/src | |
parent | 4d3fd62f897da50db1b203b86f45b9d2cd272b4d (diff) |
Significantly more glorious marks
Diffstat (limited to 'crates/ra_assists/src')
-rw-r--r-- | crates/ra_assists/src/handlers/add_turbo_fish.rs | 12 | ||||
-rw-r--r-- | crates/ra_assists/src/marks.rs | 2 |
2 files changed, 6 insertions, 8 deletions
diff --git a/crates/ra_assists/src/handlers/add_turbo_fish.rs b/crates/ra_assists/src/handlers/add_turbo_fish.rs index a0363bc78..26acf81f2 100644 --- a/crates/ra_assists/src/handlers/add_turbo_fish.rs +++ b/crates/ra_assists/src/handlers/add_turbo_fish.rs | |||
@@ -1,11 +1,11 @@ | |||
1 | use ra_ide_db::defs::{classify_name_ref, Definition, NameRefClass}; | 1 | use ra_ide_db::defs::{classify_name_ref, Definition, NameRefClass}; |
2 | use ra_syntax::{ast, AstNode, SyntaxKind, T}; | 2 | use ra_syntax::{ast, AstNode, SyntaxKind, T}; |
3 | use test_utils::mark; | ||
3 | 4 | ||
4 | use crate::{ | 5 | use crate::{ |
5 | assist_context::{AssistContext, Assists}, | 6 | assist_context::{AssistContext, Assists}, |
6 | AssistId, | 7 | AssistId, |
7 | }; | 8 | }; |
8 | use test_utils::tested_by; | ||
9 | 9 | ||
10 | // Assist: add_turbo_fish | 10 | // Assist: add_turbo_fish |
11 | // | 11 | // |
@@ -28,7 +28,7 @@ pub(crate) fn add_turbo_fish(acc: &mut Assists, ctx: &AssistContext) -> Option<( | |||
28 | let ident = ctx.find_token_at_offset(SyntaxKind::IDENT)?; | 28 | let ident = ctx.find_token_at_offset(SyntaxKind::IDENT)?; |
29 | let next_token = ident.next_token()?; | 29 | let next_token = ident.next_token()?; |
30 | if next_token.kind() == T![::] { | 30 | if next_token.kind() == T![::] { |
31 | tested_by!(add_turbo_fish_one_fish_is_enough); | 31 | mark::hit!(add_turbo_fish_one_fish_is_enough); |
32 | return None; | 32 | return None; |
33 | } | 33 | } |
34 | let name_ref = ast::NameRef::cast(ident.parent())?; | 34 | let name_ref = ast::NameRef::cast(ident.parent())?; |
@@ -42,7 +42,7 @@ pub(crate) fn add_turbo_fish(acc: &mut Assists, ctx: &AssistContext) -> Option<( | |||
42 | }; | 42 | }; |
43 | let generics = hir::GenericDef::Function(fun).params(ctx.sema.db); | 43 | let generics = hir::GenericDef::Function(fun).params(ctx.sema.db); |
44 | if generics.is_empty() { | 44 | if generics.is_empty() { |
45 | tested_by!(add_turbo_fish_non_generic); | 45 | mark::hit!(add_turbo_fish_non_generic); |
46 | return None; | 46 | return None; |
47 | } | 47 | } |
48 | acc.add(AssistId("add_turbo_fish"), "Add `::<>`", ident.text_range(), |builder| { | 48 | acc.add(AssistId("add_turbo_fish"), "Add `::<>`", ident.text_range(), |builder| { |
@@ -58,7 +58,7 @@ mod tests { | |||
58 | use crate::tests::{check_assist, check_assist_not_applicable}; | 58 | use crate::tests::{check_assist, check_assist_not_applicable}; |
59 | 59 | ||
60 | use super::*; | 60 | use super::*; |
61 | use test_utils::covers; | 61 | use test_utils::mark; |
62 | 62 | ||
63 | #[test] | 63 | #[test] |
64 | fn add_turbo_fish_function() { | 64 | fn add_turbo_fish_function() { |
@@ -106,7 +106,7 @@ fn main() { | |||
106 | 106 | ||
107 | #[test] | 107 | #[test] |
108 | fn add_turbo_fish_one_fish_is_enough() { | 108 | fn add_turbo_fish_one_fish_is_enough() { |
109 | covers!(add_turbo_fish_one_fish_is_enough); | 109 | mark::check!(add_turbo_fish_one_fish_is_enough); |
110 | check_assist_not_applicable( | 110 | check_assist_not_applicable( |
111 | add_turbo_fish, | 111 | add_turbo_fish, |
112 | r#" | 112 | r#" |
@@ -120,7 +120,7 @@ fn main() { | |||
120 | 120 | ||
121 | #[test] | 121 | #[test] |
122 | fn add_turbo_fish_non_generic() { | 122 | fn add_turbo_fish_non_generic() { |
123 | covers!(add_turbo_fish_non_generic); | 123 | mark::check!(add_turbo_fish_non_generic); |
124 | check_assist_not_applicable( | 124 | check_assist_not_applicable( |
125 | add_turbo_fish, | 125 | add_turbo_fish, |
126 | r#" | 126 | r#" |
diff --git a/crates/ra_assists/src/marks.rs b/crates/ra_assists/src/marks.rs index 722f3c6a4..525ec4abc 100644 --- a/crates/ra_assists/src/marks.rs +++ b/crates/ra_assists/src/marks.rs | |||
@@ -10,6 +10,4 @@ test_utils::marks![ | |||
10 | test_not_applicable_if_variable_unused | 10 | test_not_applicable_if_variable_unused |
11 | change_visibility_field_false_positive | 11 | change_visibility_field_false_positive |
12 | test_add_from_impl_already_exists | 12 | test_add_from_impl_already_exists |
13 | add_turbo_fish_one_fish_is_enough | ||
14 | add_turbo_fish_non_generic | ||
15 | ]; | 13 | ]; |