@@ -18,31 +18,41 @@ use crate::{DiagnosticsConfig, ExprFillDefaultMode, Severity};
1818/// * the first diagnostic fix trigger range touches the input cursor position
1919/// * that the contents of the file containing the cursor match `after` after the diagnostic fix is applied
2020#[ 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+ ) {
2225 check_nth_fix ( 0 , ra_fixture_before, ra_fixture_after) ;
2326}
2427/// Takes a multi-file input fixture with annotated cursor positions,
2528/// and checks that:
2629/// * a diagnostic is produced
2730/// * every diagnostic fixes trigger range touches the input cursor position
2831/// * 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+ ) {
3036 for ( i, ra_fixture_after) in ra_fixtures_after. iter ( ) . enumerate ( ) {
3137 check_nth_fix ( i, ra_fixture_before, ra_fixture_after)
3238 }
3339}
3440
3541#[ 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+ ) {
3747 let mut config = DiagnosticsConfig :: test_sample ( ) ;
3848 config. expr_fill_default = ExprFillDefaultMode :: Default ;
3949 check_nth_fix_with_config ( config, nth, ra_fixture_before, ra_fixture_after)
4050}
4151
4252#[ track_caller]
4353pub ( 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 ,
4656 disabled : impl Iterator < Item = String > ,
4757) {
4858 let mut config = DiagnosticsConfig :: test_sample ( ) ;
@@ -55,8 +65,8 @@ pub(crate) fn check_fix_with_disabled(
5565fn check_nth_fix_with_config (
5666 config : DiagnosticsConfig ,
5767 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 ,
6070) {
6171 let after = trim_indent ( ra_fixture_after) ;
6272
@@ -95,14 +105,20 @@ fn check_nth_fix_with_config(
95105 assert_eq_text ! ( & after, & actual) ;
96106}
97107
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+ ) {
99112 for ra_fixture_after in ra_fixtures_after. iter ( ) {
100113 check_has_fix ( ra_fixture_before, ra_fixture_after)
101114 }
102115}
103116
104117#[ 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+ ) {
106122 let after = trim_indent ( ra_fixture_after) ;
107123
108124 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) {
145161}
146162
147163#[ 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+ ) {
149168 let after = trim_indent ( ra_fixture_after) ;
150169
151170 let ( db, file_position) = RootDatabase :: with_position ( ra_fixture_before) ;
0 commit comments