diff --git a/crates/hir-def/src/body/scope.rs b/crates/hir-def/src/body/scope.rs index 63a7a9af20..08af470b96 100644 --- a/crates/hir-def/src/body/scope.rs +++ b/crates/hir-def/src/body/scope.rs @@ -345,7 +345,7 @@ mod tests { } } - fn do_check(ra_fixture: &str, expected: &[&str]) { + fn do_check(#[rust_analyzer::rust_fixture] ra_fixture: &str, expected: &[&str]) { let (offset, code) = extract_offset(ra_fixture); let code = { let mut buf = String::new(); @@ -509,7 +509,7 @@ fn foo() { ); } - fn do_check_local_name(ra_fixture: &str, expected_offset: u32) { + fn do_check_local_name(#[rust_analyzer::rust_fixture] ra_fixture: &str, expected_offset: u32) { let (db, position) = TestDB::with_position(ra_fixture); let file_id = position.file_id; let offset = position.offset; diff --git a/crates/hir-def/src/body/tests.rs b/crates/hir-def/src/body/tests.rs index 7e15a9f2d6..65f44dbc35 100644 --- a/crates/hir-def/src/body/tests.rs +++ b/crates/hir-def/src/body/tests.rs @@ -7,7 +7,7 @@ use crate::{test_db::TestDB, ModuleDefId}; use super::*; -fn lower(ra_fixture: &str) -> (TestDB, Arc
, DefWithBodyId) { +fn lower(#[rust_analyzer::rust_fixture] ra_fixture: &str) -> (TestDB, Arc, DefWithBodyId) { let db = TestDB::with_files(ra_fixture); let krate = db.fetch_test_crate(); @@ -27,14 +27,14 @@ fn lower(ra_fixture: &str) -> (TestDB, Arc, DefWithBodyId) { (db, body, fn_def) } -fn def_map_at(ra_fixture: &str) -> String { +fn def_map_at(#[rust_analyzer::rust_fixture] ra_fixture: &str) -> String { let (db, position) = TestDB::with_position(ra_fixture); let module = db.module_at_position(position); module.def_map(&db).dump(&db) } -fn check_block_scopes_at(ra_fixture: &str, expect: Expect) { +fn check_block_scopes_at(#[rust_analyzer::rust_fixture] ra_fixture: &str, expect: Expect) { let (db, position) = TestDB::with_position(ra_fixture); let module = db.module_at_position(position); @@ -42,7 +42,7 @@ fn check_block_scopes_at(ra_fixture: &str, expect: Expect) { expect.assert_eq(&actual); } -fn check_at(ra_fixture: &str, expect: Expect) { +fn check_at(#[rust_analyzer::rust_fixture] ra_fixture: &str, expect: Expect) { let actual = def_map_at(ra_fixture); expect.assert_eq(&actual); } diff --git a/crates/hir-def/src/find_path.rs b/crates/hir-def/src/find_path.rs index a615abd1bb..5d67902c8a 100644 --- a/crates/hir-def/src/find_path.rs +++ b/crates/hir-def/src/find_path.rs @@ -665,7 +665,7 @@ mod tests { /// module the cursor is in. #[track_caller] fn check_found_path_( - ra_fixture: &str, + #[rust_analyzer::rust_fixture] ra_fixture: &str, path: &str, prefer_prelude: bool, prefer_absolute: bool, @@ -727,19 +727,35 @@ mod tests { expect.assert_eq(&res); } - fn check_found_path(ra_fixture: &str, path: &str, expect: Expect) { + fn check_found_path( + #[rust_analyzer::rust_fixture] ra_fixture: &str, + path: &str, + expect: Expect, + ) { check_found_path_(ra_fixture, path, false, false, false, expect); } - fn check_found_path_prelude(ra_fixture: &str, path: &str, expect: Expect) { + fn check_found_path_prelude( + #[rust_analyzer::rust_fixture] ra_fixture: &str, + path: &str, + expect: Expect, + ) { check_found_path_(ra_fixture, path, true, false, false, expect); } - fn check_found_path_absolute(ra_fixture: &str, path: &str, expect: Expect) { + fn check_found_path_absolute( + #[rust_analyzer::rust_fixture] ra_fixture: &str, + path: &str, + expect: Expect, + ) { check_found_path_(ra_fixture, path, false, true, false, expect); } - fn check_found_path_prefer_no_std(ra_fixture: &str, path: &str, expect: Expect) { + fn check_found_path_prefer_no_std( + #[rust_analyzer::rust_fixture] ra_fixture: &str, + path: &str, + expect: Expect, + ) { check_found_path_(ra_fixture, path, false, false, true, expect); } diff --git a/crates/hir-def/src/import_map.rs b/crates/hir-def/src/import_map.rs index 9574e5d9cd..ac262950f1 100644 --- a/crates/hir-def/src/import_map.rs +++ b/crates/hir-def/src/import_map.rs @@ -509,7 +509,12 @@ mod tests { } } - fn check_search(ra_fixture: &str, crate_name: &str, query: Query, expect: Expect) { + fn check_search( + #[rust_analyzer::rust_fixture] ra_fixture: &str, + crate_name: &str, + query: Query, + expect: Expect, + ) { let db = TestDB::with_files(ra_fixture); let crate_graph = db.crate_graph(); let krate = crate_graph @@ -587,7 +592,7 @@ mod tests { )) } - fn check(ra_fixture: &str, expect: Expect) { + fn check(#[rust_analyzer::rust_fixture] ra_fixture: &str, expect: Expect) { let db = TestDB::with_files(ra_fixture); let crate_graph = db.crate_graph(); diff --git a/crates/hir-def/src/item_tree/tests.rs b/crates/hir-def/src/item_tree/tests.rs index 735586c049..80b699649f 100644 --- a/crates/hir-def/src/item_tree/tests.rs +++ b/crates/hir-def/src/item_tree/tests.rs @@ -4,7 +4,7 @@ use test_fixture::WithFixture; use crate::{db::DefDatabase, test_db::TestDB}; -fn check(ra_fixture: &str, expect: Expect) { +fn check(#[rust_analyzer::rust_fixture] ra_fixture: &str, expect: Expect) { let (db, file_id) = TestDB::with_single_file(ra_fixture); let item_tree = db.file_item_tree(file_id.into()); let pretty = item_tree.pretty_print(&db, Edition::CURRENT); diff --git a/crates/hir-def/src/macro_expansion_tests/mod.rs b/crates/hir-def/src/macro_expansion_tests/mod.rs index adcf278472..408d03ff71 100644 --- a/crates/hir-def/src/macro_expansion_tests/mod.rs +++ b/crates/hir-def/src/macro_expansion_tests/mod.rs @@ -47,7 +47,7 @@ use crate::{ }; #[track_caller] -fn check_errors(ra_fixture: &str, expect: Expect) { +fn check_errors(#[rust_analyzer::rust_fixture] ra_fixture: &str, expect: Expect) { let db = TestDB::with_files(ra_fixture); let krate = db.fetch_test_crate(); let def_map = db.crate_def_map(krate); @@ -77,7 +77,7 @@ fn check_errors(ra_fixture: &str, expect: Expect) { } #[track_caller] -fn check(ra_fixture: &str, mut expect: Expect) { +fn check(#[rust_analyzer::rust_fixture] ra_fixture: &str, mut expect: Expect) { let extra_proc_macros = vec![( r#" #[proc_macro_attribute] diff --git a/crates/hir-def/src/nameres/tests.rs b/crates/hir-def/src/nameres/tests.rs index 32c158415b..318aee04f7 100644 --- a/crates/hir-def/src/nameres/tests.rs +++ b/crates/hir-def/src/nameres/tests.rs @@ -11,19 +11,19 @@ use triomphe::Arc; use crate::{db::DefDatabase, nameres::DefMap, test_db::TestDB}; -fn compute_crate_def_map(ra_fixture: &str) -> Arc