@@ -18,31 +18,41 @@ use crate::{DiagnosticsConfig, ExprFillDefaultMode, Severity};
18
18
/// * the first diagnostic fix trigger range touches the input cursor position
19
19
/// * that the contents of the file containing the cursor match `after` after the diagnostic fix is applied
20
20
#[ track_caller]
21
- pub ( crate ) fn check_fix ( ra_fixture_before : & str , ra_fixture_after : & str ) {
21
+ pub ( crate ) fn check_fix (
22
+ #[ rust_analyzer:: rust_fixture] ra_fixture_before : & str ,
23
+ #[ rust_analyzer:: rust_fixture] ra_fixture_after : & str ,
24
+ ) {
22
25
check_nth_fix ( 0 , ra_fixture_before, ra_fixture_after) ;
23
26
}
24
27
/// Takes a multi-file input fixture with annotated cursor positions,
25
28
/// and checks that:
26
29
/// * a diagnostic is produced
27
30
/// * every diagnostic fixes trigger range touches the input cursor position
28
31
/// * that the contents of the file containing the cursor match `after` after each diagnostic fix is applied
29
- pub ( crate ) fn check_fixes ( ra_fixture_before : & str , ra_fixtures_after : Vec < & str > ) {
32
+ pub ( crate ) fn check_fixes (
33
+ #[ rust_analyzer:: rust_fixture] ra_fixture_before : & str ,
34
+ ra_fixtures_after : Vec < & str > ,
35
+ ) {
30
36
for ( i, ra_fixture_after) in ra_fixtures_after. iter ( ) . enumerate ( ) {
31
37
check_nth_fix ( i, ra_fixture_before, ra_fixture_after)
32
38
}
33
39
}
34
40
35
41
#[ track_caller]
36
- fn check_nth_fix ( nth : usize , ra_fixture_before : & str , ra_fixture_after : & str ) {
42
+ fn check_nth_fix (
43
+ nth : usize ,
44
+ #[ rust_analyzer:: rust_fixture] ra_fixture_before : & str ,
45
+ #[ rust_analyzer:: rust_fixture] ra_fixture_after : & str ,
46
+ ) {
37
47
let mut config = DiagnosticsConfig :: test_sample ( ) ;
38
48
config. expr_fill_default = ExprFillDefaultMode :: Default ;
39
49
check_nth_fix_with_config ( config, nth, ra_fixture_before, ra_fixture_after)
40
50
}
41
51
42
52
#[ track_caller]
43
53
pub ( crate ) fn check_fix_with_disabled (
44
- ra_fixture_before : & str ,
45
- ra_fixture_after : & str ,
54
+ # [ rust_analyzer :: rust_fixture ] ra_fixture_before : & str ,
55
+ # [ rust_analyzer :: rust_fixture ] ra_fixture_after : & str ,
46
56
disabled : impl Iterator < Item = String > ,
47
57
) {
48
58
let mut config = DiagnosticsConfig :: test_sample ( ) ;
@@ -55,8 +65,8 @@ pub(crate) fn check_fix_with_disabled(
55
65
fn check_nth_fix_with_config (
56
66
config : DiagnosticsConfig ,
57
67
nth : usize ,
58
- ra_fixture_before : & str ,
59
- ra_fixture_after : & str ,
68
+ # [ rust_analyzer :: rust_fixture ] ra_fixture_before : & str ,
69
+ # [ rust_analyzer :: rust_fixture ] ra_fixture_after : & str ,
60
70
) {
61
71
let after = trim_indent ( ra_fixture_after) ;
62
72
@@ -95,14 +105,20 @@ fn check_nth_fix_with_config(
95
105
assert_eq_text ! ( & after, & actual) ;
96
106
}
97
107
98
- pub ( crate ) fn check_fixes_unordered ( ra_fixture_before : & str , ra_fixtures_after : Vec < & str > ) {
108
+ pub ( crate ) fn check_fixes_unordered (
109
+ #[ rust_analyzer:: rust_fixture] ra_fixture_before : & str ,
110
+ ra_fixtures_after : Vec < & str > ,
111
+ ) {
99
112
for ra_fixture_after in ra_fixtures_after. iter ( ) {
100
113
check_has_fix ( ra_fixture_before, ra_fixture_after)
101
114
}
102
115
}
103
116
104
117
#[ track_caller]
105
- pub ( crate ) fn check_has_fix ( ra_fixture_before : & str , ra_fixture_after : & str ) {
118
+ pub ( crate ) fn check_has_fix (
119
+ #[ rust_analyzer:: rust_fixture] ra_fixture_before : & str ,
120
+ #[ rust_analyzer:: rust_fixture] ra_fixture_after : & str ,
121
+ ) {
106
122
let after = trim_indent ( ra_fixture_after) ;
107
123
108
124
let ( db, file_position) = RootDatabase :: with_position ( ra_fixture_before) ;
@@ -145,7 +161,10 @@ pub(crate) fn check_has_fix(ra_fixture_before: &str, ra_fixture_after: &str) {
145
161
}
146
162
147
163
#[ track_caller]
148
- pub ( crate ) fn check_has_single_fix ( ra_fixture_before : & str , ra_fixture_after : & str ) {
164
+ pub ( crate ) fn check_has_single_fix (
165
+ #[ rust_analyzer:: rust_fixture] ra_fixture_before : & str ,
166
+ #[ rust_analyzer:: rust_fixture] ra_fixture_after : & str ,
167
+ ) {
149
168
let after = trim_indent ( ra_fixture_after) ;
150
169
151
170
let ( db, file_position) = RootDatabase :: with_position ( ra_fixture_before) ;
0 commit comments