Skip to content

Commit ecac5d7

Browse files
committed
Switch to new magic marks
1 parent 5258c81 commit ecac5d7

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

42 files changed

+152
-298
lines changed

crates/ra_assists/src/handlers/add_from_impl_for_enum.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
use ra_ide_db::RootDatabase;
22
use ra_syntax::ast::{self, AstNode, NameOwner};
3-
use test_utils::tested_by;
3+
use test_utils::mark;
44

55
use crate::{utils::FamousDefs, AssistContext, AssistId, Assists};
66

@@ -39,7 +39,7 @@ pub(crate) fn add_from_impl_for_enum(acc: &mut Assists, ctx: &AssistContext) ->
3939
};
4040

4141
if existing_from_impl(&ctx.sema, &variant).is_some() {
42-
tested_by!(test_add_from_impl_already_exists);
42+
mark::hit!(test_add_from_impl_already_exists);
4343
return None;
4444
}
4545

@@ -90,7 +90,7 @@ fn existing_from_impl(
9090

9191
#[cfg(test)]
9292
mod tests {
93-
use test_utils::covers;
93+
use test_utils::mark;
9494

9595
use crate::tests::{check_assist, check_assist_not_applicable};
9696

@@ -149,7 +149,7 @@ impl From<foo::bar::baz::Boo> for A {
149149

150150
#[test]
151151
fn test_add_from_impl_already_exists() {
152-
covers!(test_add_from_impl_already_exists);
152+
mark::check!(test_add_from_impl_already_exists);
153153
check_not_applicable(
154154
r#"
155155
enum A { <|>One(u32), }

crates/ra_assists/src/handlers/change_visibility.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ use ra_syntax::{
99
};
1010

1111
use hir::{db::HirDatabase, HasSource, HasVisibility, PathResolution};
12-
use test_utils::tested_by;
12+
use test_utils::mark;
1313

1414
use crate::{AssistContext, AssistId, Assists};
1515
use ra_db::FileId;
@@ -55,7 +55,7 @@ fn add_vis(acc: &mut Assists, ctx: &AssistContext) -> Option<()> {
5555
} else if let Some(field_name) = ctx.find_node_at_offset::<ast::Name>() {
5656
let field = field_name.syntax().ancestors().find_map(ast::RecordFieldDef::cast)?;
5757
if field.name()? != field_name {
58-
tested_by!(change_visibility_field_false_positive);
58+
mark::hit!(change_visibility_field_false_positive);
5959
return None;
6060
}
6161
if field.visibility().is_some() {
@@ -255,7 +255,7 @@ fn change_vis(acc: &mut Assists, vis: ast::Visibility) -> Option<()> {
255255

256256
#[cfg(test)]
257257
mod tests {
258-
use test_utils::covers;
258+
use test_utils::mark;
259259

260260
use crate::tests::{check_assist, check_assist_not_applicable, check_assist_target};
261261

@@ -288,7 +288,7 @@ mod tests {
288288

289289
#[test]
290290
fn change_visibility_field_false_positive() {
291-
covers!(change_visibility_field_false_positive);
291+
mark::check!(change_visibility_field_false_positive);
292292
check_assist_not_applicable(
293293
change_visibility,
294294
r"struct S { field: [(); { let <|>x = ();}] }",

crates/ra_assists/src/handlers/fill_match_arms.rs

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ use hir::{Adt, HasSource, ModuleDef, Semantics};
44
use itertools::Itertools;
55
use ra_ide_db::RootDatabase;
66
use ra_syntax::ast::{self, make, AstNode, MatchArm, NameOwner, Pat};
7-
use test_utils::tested_by;
7+
use test_utils::mark;
88

99
use crate::{utils::FamousDefs, AssistContext, AssistId, Assists};
1010

@@ -58,7 +58,7 @@ pub(crate) fn fill_match_arms(acc: &mut Assists, ctx: &AssistContext) -> Option<
5858
.collect::<Vec<_>>();
5959
if Some(enum_def) == FamousDefs(&ctx.sema, module.krate()).core_option_Option() {
6060
// Match `Some` variant first.
61-
tested_by!(option_order);
61+
mark::hit!(option_order);
6262
variants.reverse()
6363
}
6464
variants
@@ -174,13 +174,14 @@ fn build_pat(db: &RootDatabase, module: hir::Module, var: hir::EnumVariant) -> O
174174

175175
#[cfg(test)]
176176
mod tests {
177+
use test_utils::mark;
178+
177179
use crate::{
178180
tests::{check_assist, check_assist_not_applicable, check_assist_target},
179181
utils::FamousDefs,
180182
};
181183

182184
use super::fill_match_arms;
183-
use test_utils::covers;
184185

185186
#[test]
186187
fn all_match_arms_provided() {
@@ -750,7 +751,7 @@ mod tests {
750751

751752
#[test]
752753
fn option_order() {
753-
covers!(option_order);
754+
mark::check!(option_order);
754755
let before = r#"
755756
fn foo(opt: Option<i32>) {
756757
match opt<|> {

crates/ra_assists/src/handlers/inline_local_variable.rs

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ use ra_syntax::{
33
ast::{self, AstNode, AstToken},
44
TextRange,
55
};
6-
use test_utils::tested_by;
6+
use test_utils::mark;
77

88
use crate::{
99
assist_context::{AssistContext, Assists},
@@ -33,11 +33,11 @@ pub(crate) fn inline_local_variable(acc: &mut Assists, ctx: &AssistContext) -> O
3333
_ => return None,
3434
};
3535
if bind_pat.mut_token().is_some() {
36-
tested_by!(test_not_inline_mut_variable);
36+
mark::hit!(test_not_inline_mut_variable);
3737
return None;
3838
}
3939
if !bind_pat.syntax().text_range().contains_inclusive(ctx.offset()) {
40-
tested_by!(not_applicable_outside_of_bind_pat);
40+
mark::hit!(not_applicable_outside_of_bind_pat);
4141
return None;
4242
}
4343
let initializer_expr = let_stmt.initializer()?;
@@ -46,7 +46,7 @@ pub(crate) fn inline_local_variable(acc: &mut Assists, ctx: &AssistContext) -> O
4646
let def = Definition::Local(def);
4747
let refs = def.find_usages(ctx.db, None);
4848
if refs.is_empty() {
49-
tested_by!(test_not_applicable_if_variable_unused);
49+
mark::hit!(test_not_applicable_if_variable_unused);
5050
return None;
5151
};
5252

@@ -122,7 +122,7 @@ pub(crate) fn inline_local_variable(acc: &mut Assists, ctx: &AssistContext) -> O
122122

123123
#[cfg(test)]
124124
mod tests {
125-
use test_utils::covers;
125+
use test_utils::mark;
126126

127127
use crate::tests::{check_assist, check_assist_not_applicable};
128128

@@ -330,7 +330,7 @@ fn foo() {
330330

331331
#[test]
332332
fn test_not_inline_mut_variable() {
333-
covers!(test_not_inline_mut_variable);
333+
mark::check!(test_not_inline_mut_variable);
334334
check_assist_not_applicable(
335335
inline_local_variable,
336336
r"
@@ -663,7 +663,7 @@ fn foo() {
663663

664664
#[test]
665665
fn test_not_applicable_if_variable_unused() {
666-
covers!(test_not_applicable_if_variable_unused);
666+
mark::check!(test_not_applicable_if_variable_unused);
667667
check_assist_not_applicable(
668668
inline_local_variable,
669669
r"
@@ -676,7 +676,7 @@ fn foo() {
676676

677677
#[test]
678678
fn not_applicable_outside_of_bind_pat() {
679-
covers!(not_applicable_outside_of_bind_pat);
679+
mark::check!(not_applicable_outside_of_bind_pat);
680680
check_assist_not_applicable(
681681
inline_local_variable,
682682
r"

crates/ra_assists/src/handlers/introduce_variable.rs

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ use ra_syntax::{
77
SyntaxNode, TextSize,
88
};
99
use stdx::format_to;
10-
use test_utils::tested_by;
10+
use test_utils::mark;
1111

1212
use crate::{AssistContext, AssistId, Assists};
1313

@@ -33,7 +33,7 @@ pub(crate) fn introduce_variable(acc: &mut Assists, ctx: &AssistContext) -> Opti
3333
}
3434
let node = ctx.covering_element();
3535
if node.kind() == COMMENT {
36-
tested_by!(introduce_var_in_comment_is_not_applicable);
36+
mark::hit!(introduce_var_in_comment_is_not_applicable);
3737
return None;
3838
}
3939
let expr = node.ancestors().find_map(valid_target_expr)?;
@@ -61,7 +61,7 @@ pub(crate) fn introduce_variable(acc: &mut Assists, ctx: &AssistContext) -> Opti
6161
false
6262
};
6363
if is_full_stmt {
64-
tested_by!(test_introduce_var_expr_stmt);
64+
mark::hit!(test_introduce_var_expr_stmt);
6565
if full_stmt.unwrap().semicolon_token().is_none() {
6666
buf.push_str(";");
6767
}
@@ -113,7 +113,7 @@ fn anchor_stmt(expr: ast::Expr) -> Option<(SyntaxNode, bool)> {
113113
expr.syntax().ancestors().find_map(|node| {
114114
if let Some(expr) = node.parent().and_then(ast::BlockExpr::cast).and_then(|it| it.expr()) {
115115
if expr.syntax() == &node {
116-
tested_by!(test_introduce_var_last_expr);
116+
mark::hit!(test_introduce_var_last_expr);
117117
return Some((node, false));
118118
}
119119
}
@@ -134,7 +134,7 @@ fn anchor_stmt(expr: ast::Expr) -> Option<(SyntaxNode, bool)> {
134134

135135
#[cfg(test)]
136136
mod tests {
137-
use test_utils::covers;
137+
use test_utils::mark;
138138

139139
use crate::tests::{check_assist, check_assist_not_applicable, check_assist_target};
140140

@@ -158,13 +158,13 @@ fn foo() {
158158

159159
#[test]
160160
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);
162162
check_assist_not_applicable(introduce_variable, "fn main() { 1 + /* <|>comment<|> */ 1; }");
163163
}
164164

165165
#[test]
166166
fn test_introduce_var_expr_stmt() {
167-
covers!(test_introduce_var_expr_stmt);
167+
mark::check!(test_introduce_var_expr_stmt);
168168
check_assist(
169169
introduce_variable,
170170
"
@@ -209,7 +209,7 @@ fn foo() {
209209

210210
#[test]
211211
fn test_introduce_var_last_expr() {
212-
covers!(test_introduce_var_last_expr);
212+
mark::check!(test_introduce_var_last_expr);
213213
check_assist(
214214
introduce_variable,
215215
"

crates/ra_assists/src/lib.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@ macro_rules! eprintln {
1212

1313
mod assist_config;
1414
mod assist_context;
15-
mod marks;
1615
#[cfg(test)]
1716
mod tests;
1817
pub mod utils;

crates/ra_assists/src/marks.rs

Lines changed: 0 additions & 13 deletions
This file was deleted.

crates/ra_hir_def/src/body/lower.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ use ra_syntax::{
1515
},
1616
AstNode, AstPtr,
1717
};
18-
use test_utils::tested_by;
18+
use test_utils::mark;
1919

2020
use crate::{
2121
adt::StructKind,
@@ -226,7 +226,7 @@ impl ExprCollector<'_> {
226226
None => self.collect_expr_opt(condition.expr()),
227227
// if let -- desugar to match
228228
Some(pat) => {
229-
tested_by!(infer_resolve_while_let);
229+
mark::hit!(infer_resolve_while_let);
230230
let pat = self.collect_pat(pat);
231231
let match_expr = self.collect_expr_opt(condition.expr());
232232
let placeholder_pat = self.missing_pat();

crates/ra_hir_def/src/body/scope.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -174,7 +174,7 @@ mod tests {
174174
use hir_expand::{name::AsName, InFile};
175175
use ra_db::{fixture::WithFixture, FileId, SourceDatabase};
176176
use ra_syntax::{algo::find_node_at_offset, ast, AstNode};
177-
use test_utils::{assert_eq_text, covers, extract_offset};
177+
use test_utils::{assert_eq_text, extract_offset, mark};
178178

179179
use crate::{db::DefDatabase, test_db::TestDB, FunctionId, ModuleDefId};
180180

@@ -388,7 +388,7 @@ mod tests {
388388

389389
#[test]
390390
fn while_let_desugaring() {
391-
covers!(infer_resolve_while_let);
391+
mark::check!(infer_resolve_while_let);
392392
do_check_local_name(
393393
r#"
394394
fn test() {

0 commit comments

Comments
 (0)