Skip to content

Commit 5a97637

Browse files
committed
Add missing #[rust_analyzer::rust_fixture] annotations
1 parent 8ec9094 commit 5a97637

File tree

10 files changed

+104
-35
lines changed

10 files changed

+104
-35
lines changed

src/tools/rust-analyzer/crates/ide-assists/src/handlers/destructure_tuple_binding.rs

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1128,7 +1128,10 @@ fn main {
11281128
destructure_tuple_binding_impl(acc, ctx, false)
11291129
}
11301130

1131-
pub(crate) fn check_in_place_assist(ra_fixture_before: &str, ra_fixture_after: &str) {
1131+
pub(crate) fn check_in_place_assist(
1132+
#[rust_analyzer::rust_fixture] ra_fixture_before: &str,
1133+
#[rust_analyzer::rust_fixture] ra_fixture_after: &str,
1134+
) {
11321135
check_assist_by_label(
11331136
in_place_assist,
11341137
ra_fixture_before,
@@ -1138,7 +1141,10 @@ fn main {
11381141
);
11391142
}
11401143

1141-
pub(crate) fn check_sub_pattern_assist(ra_fixture_before: &str, ra_fixture_after: &str) {
1144+
pub(crate) fn check_sub_pattern_assist(
1145+
#[rust_analyzer::rust_fixture] ra_fixture_before: &str,
1146+
#[rust_analyzer::rust_fixture] ra_fixture_after: &str,
1147+
) {
11421148
check_assist_by_label(
11431149
assist,
11441150
ra_fixture_before,

src/tools/rust-analyzer/crates/ide-assists/src/handlers/remove_dbg.rs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -209,7 +209,10 @@ mod tests {
209209

210210
use super::*;
211211

212-
fn check(ra_fixture_before: &str, ra_fixture_after: &str) {
212+
fn check(
213+
#[rust_analyzer::rust_fixture] ra_fixture_before: &str,
214+
#[rust_analyzer::rust_fixture] ra_fixture_after: &str,
215+
) {
213216
check_assist(
214217
remove_dbg,
215218
&format!("fn main() {{\n{ra_fixture_before}\n}}"),

src/tools/rust-analyzer/crates/ide-assists/src/tests.rs

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -77,16 +77,20 @@ pub(crate) fn with_single_file(text: &str) -> (RootDatabase, EditionedFileId) {
7777
}
7878

7979
#[track_caller]
80-
pub(crate) fn check_assist(assist: Handler, ra_fixture_before: &str, ra_fixture_after: &str) {
80+
pub(crate) fn check_assist(
81+
assist: Handler,
82+
#[rust_analyzer::rust_fixture] ra_fixture_before: &str,
83+
#[rust_analyzer::rust_fixture] ra_fixture_after: &str,
84+
) {
8185
let ra_fixture_after = trim_indent(ra_fixture_after);
8286
check(assist, ra_fixture_before, ExpectedResult::After(&ra_fixture_after), None);
8387
}
8488

8589
#[track_caller]
8690
pub(crate) fn check_assist_no_snippet_cap(
8791
assist: Handler,
88-
ra_fixture_before: &str,
89-
ra_fixture_after: &str,
92+
#[rust_analyzer::rust_fixture] ra_fixture_before: &str,
93+
#[rust_analyzer::rust_fixture] ra_fixture_after: &str,
9094
) {
9195
let ra_fixture_after = trim_indent(ra_fixture_after);
9296
check_with_config(
@@ -101,8 +105,8 @@ pub(crate) fn check_assist_no_snippet_cap(
101105
#[track_caller]
102106
pub(crate) fn check_assist_import_one(
103107
assist: Handler,
104-
ra_fixture_before: &str,
105-
ra_fixture_after: &str,
108+
#[rust_analyzer::rust_fixture] ra_fixture_before: &str,
109+
#[rust_analyzer::rust_fixture] ra_fixture_after: &str,
106110
) {
107111
let ra_fixture_after = trim_indent(ra_fixture_after);
108112
check_with_config(
@@ -118,8 +122,8 @@ pub(crate) fn check_assist_import_one(
118122
// so this is here to allow you choose.
119123
pub(crate) fn check_assist_by_label(
120124
assist: Handler,
121-
ra_fixture_before: &str,
122-
ra_fixture_after: &str,
125+
#[rust_analyzer::rust_fixture] ra_fixture_before: &str,
126+
#[rust_analyzer::rust_fixture] ra_fixture_after: &str,
123127
label: &str,
124128
) {
125129
let ra_fixture_after = trim_indent(ra_fixture_after);

src/tools/rust-analyzer/crates/ide-completion/src/tests.rs

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -220,7 +220,11 @@ fn render_completion_list(completions: Vec<CompletionItem>) -> String {
220220
}
221221

222222
#[track_caller]
223-
pub(crate) fn check_edit(what: &str, ra_fixture_before: &str, ra_fixture_after: &str) {
223+
pub(crate) fn check_edit(
224+
what: &str,
225+
#[rust_analyzer::rust_fixture] ra_fixture_before: &str,
226+
#[rust_analyzer::rust_fixture] ra_fixture_after: &str,
227+
) {
224228
check_edit_with_config(TEST_CONFIG, what, ra_fixture_before, ra_fixture_after)
225229
}
226230

src/tools/rust-analyzer/crates/ide-db/src/imports/insert_use/tests.rs

Lines changed: 24 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1244,8 +1244,8 @@ use ::ext::foo::Foo;
12441244

12451245
fn check_with_config(
12461246
path: &str,
1247-
ra_fixture_before: &str,
1248-
ra_fixture_after: &str,
1247+
#[rust_analyzer::rust_fixture] ra_fixture_before: &str,
1248+
#[rust_analyzer::rust_fixture] ra_fixture_after: &str,
12491249
config: &InsertUseConfig,
12501250
) {
12511251
let (db, file_id, pos) = if ra_fixture_before.contains(CURSOR_MARKER) {
@@ -1277,8 +1277,8 @@ fn check_with_config(
12771277

12781278
fn check(
12791279
path: &str,
1280-
ra_fixture_before: &str,
1281-
ra_fixture_after: &str,
1280+
#[rust_analyzer::rust_fixture] ra_fixture_before: &str,
1281+
#[rust_analyzer::rust_fixture] ra_fixture_after: &str,
12821282
granularity: ImportGranularity,
12831283
) {
12841284
check_with_config(
@@ -1295,19 +1295,35 @@ fn check(
12951295
)
12961296
}
12971297

1298-
fn check_crate(path: &str, ra_fixture_before: &str, ra_fixture_after: &str) {
1298+
fn check_crate(
1299+
path: &str,
1300+
#[rust_analyzer::rust_fixture] ra_fixture_before: &str,
1301+
#[rust_analyzer::rust_fixture] ra_fixture_after: &str,
1302+
) {
12991303
check(path, ra_fixture_before, ra_fixture_after, ImportGranularity::Crate)
13001304
}
13011305

1302-
fn check_module(path: &str, ra_fixture_before: &str, ra_fixture_after: &str) {
1306+
fn check_module(
1307+
path: &str,
1308+
#[rust_analyzer::rust_fixture] ra_fixture_before: &str,
1309+
#[rust_analyzer::rust_fixture] ra_fixture_after: &str,
1310+
) {
13031311
check(path, ra_fixture_before, ra_fixture_after, ImportGranularity::Module)
13041312
}
13051313

1306-
fn check_none(path: &str, ra_fixture_before: &str, ra_fixture_after: &str) {
1314+
fn check_none(
1315+
path: &str,
1316+
#[rust_analyzer::rust_fixture] ra_fixture_before: &str,
1317+
#[rust_analyzer::rust_fixture] ra_fixture_after: &str,
1318+
) {
13071319
check(path, ra_fixture_before, ra_fixture_after, ImportGranularity::Item)
13081320
}
13091321

1310-
fn check_one(path: &str, ra_fixture_before: &str, ra_fixture_after: &str) {
1322+
fn check_one(
1323+
path: &str,
1324+
#[rust_analyzer::rust_fixture] ra_fixture_before: &str,
1325+
#[rust_analyzer::rust_fixture] ra_fixture_after: &str,
1326+
) {
13111327
check(path, ra_fixture_before, ra_fixture_after, ImportGranularity::One)
13121328
}
13131329

src/tools/rust-analyzer/crates/ide-diagnostics/src/tests.rs

Lines changed: 29 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -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]
4353
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,
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(
5565
fn 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);

src/tools/rust-analyzer/crates/ide/src/join_lines.rs

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -307,7 +307,10 @@ mod tests {
307307

308308
use super::*;
309309

310-
fn check_join_lines(ra_fixture_before: &str, ra_fixture_after: &str) {
310+
fn check_join_lines(
311+
#[rust_analyzer::rust_fixture] ra_fixture_before: &str,
312+
#[rust_analyzer::rust_fixture] ra_fixture_after: &str,
313+
) {
311314
let config = JoinLinesConfig {
312315
join_else_if: true,
313316
remove_trailing_comma: true,
@@ -333,7 +336,10 @@ mod tests {
333336
assert_eq_text!(ra_fixture_after, &actual);
334337
}
335338

336-
fn check_join_lines_sel(ra_fixture_before: &str, ra_fixture_after: &str) {
339+
fn check_join_lines_sel(
340+
#[rust_analyzer::rust_fixture] ra_fixture_before: &str,
341+
#[rust_analyzer::rust_fixture] ra_fixture_after: &str,
342+
) {
337343
let config = JoinLinesConfig {
338344
join_else_if: true,
339345
remove_trailing_comma: true,

src/tools/rust-analyzer/crates/ide/src/rename.rs

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -456,7 +456,11 @@ mod tests {
456456
use super::{RangeInfo, RenameError};
457457

458458
#[track_caller]
459-
fn check(new_name: &str, ra_fixture_before: &str, ra_fixture_after: &str) {
459+
fn check(
460+
new_name: &str,
461+
#[rust_analyzer::rust_fixture] ra_fixture_before: &str,
462+
#[rust_analyzer::rust_fixture] ra_fixture_after: &str,
463+
) {
460464
let ra_fixture_after = &trim_indent(ra_fixture_after);
461465
let (analysis, position) = fixture::position(ra_fixture_before);
462466
if !ra_fixture_after.starts_with("error: ") {

src/tools/rust-analyzer/crates/ide/src/typing.rs

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -436,14 +436,18 @@ mod tests {
436436
})
437437
}
438438

439-
fn type_char(char_typed: char, ra_fixture_before: &str, ra_fixture_after: &str) {
439+
fn type_char(
440+
char_typed: char,
441+
#[rust_analyzer::rust_fixture] ra_fixture_before: &str,
442+
#[rust_analyzer::rust_fixture] ra_fixture_after: &str,
443+
) {
440444
let actual = do_type_char(char_typed, ra_fixture_before)
441445
.unwrap_or_else(|| panic!("typing `{char_typed}` did nothing"));
442446

443447
assert_eq_text!(ra_fixture_after, &actual);
444448
}
445449

446-
fn type_char_noop(char_typed: char, ra_fixture_before: &str) {
450+
fn type_char_noop(char_typed: char, #[rust_analyzer::rust_fixture] ra_fixture_before: &str) {
447451
let file_change = do_type_char(char_typed, ra_fixture_before);
448452
assert_eq!(file_change, None)
449453
}

src/tools/rust-analyzer/crates/ide/src/typing/on_enter.rs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -208,7 +208,10 @@ mod tests {
208208
Some(actual)
209209
}
210210

211-
fn do_check(ra_fixture_before: &str, ra_fixture_after: &str) {
211+
fn do_check(
212+
#[rust_analyzer::rust_fixture] ra_fixture_before: &str,
213+
#[rust_analyzer::rust_fixture] ra_fixture_after: &str,
214+
) {
212215
let ra_fixture_after = &trim_indent(ra_fixture_after);
213216
let actual = apply_on_enter(ra_fixture_before).unwrap();
214217
assert_eq_text!(ra_fixture_after, &actual);

0 commit comments

Comments
 (0)