Unnamed repository; edit this file 'description' to name the repository.
-rw-r--r--crates/ide-assists/src/handlers/destructure_tuple_binding.rs10
-rw-r--r--crates/ide-assists/src/handlers/remove_dbg.rs5
-rw-r--r--crates/ide-assists/src/tests.rs18
-rw-r--r--crates/ide-completion/src/tests.rs6
-rw-r--r--crates/ide-db/src/imports/insert_use/tests.rs32
-rw-r--r--crates/ide-diagnostics/src/tests.rs39
-rw-r--r--crates/ide/src/join_lines.rs10
-rw-r--r--crates/ide/src/rename.rs6
-rw-r--r--crates/ide/src/typing.rs8
-rw-r--r--crates/ide/src/typing/on_enter.rs5
10 files changed, 104 insertions, 35 deletions
diff --git a/crates/ide-assists/src/handlers/destructure_tuple_binding.rs b/crates/ide-assists/src/handlers/destructure_tuple_binding.rs
index 7df6ca1565..39142d6062 100644
--- a/crates/ide-assists/src/handlers/destructure_tuple_binding.rs
+++ b/crates/ide-assists/src/handlers/destructure_tuple_binding.rs
@@ -1128,7 +1128,10 @@ fn main {
destructure_tuple_binding_impl(acc, ctx, false)
}
- pub(crate) fn check_in_place_assist(ra_fixture_before: &str, ra_fixture_after: &str) {
+ pub(crate) fn check_in_place_assist(
+ #[rust_analyzer::rust_fixture] ra_fixture_before: &str,
+ #[rust_analyzer::rust_fixture] ra_fixture_after: &str,
+ ) {
check_assist_by_label(
in_place_assist,
ra_fixture_before,
@@ -1138,7 +1141,10 @@ fn main {
);
}
- pub(crate) fn check_sub_pattern_assist(ra_fixture_before: &str, ra_fixture_after: &str) {
+ pub(crate) fn check_sub_pattern_assist(
+ #[rust_analyzer::rust_fixture] ra_fixture_before: &str,
+ #[rust_analyzer::rust_fixture] ra_fixture_after: &str,
+ ) {
check_assist_by_label(
assist,
ra_fixture_before,
diff --git a/crates/ide-assists/src/handlers/remove_dbg.rs b/crates/ide-assists/src/handlers/remove_dbg.rs
index ae14075c26..1f57f7d3d3 100644
--- a/crates/ide-assists/src/handlers/remove_dbg.rs
+++ b/crates/ide-assists/src/handlers/remove_dbg.rs
@@ -209,7 +209,10 @@ mod tests {
use super::*;
- fn check(ra_fixture_before: &str, ra_fixture_after: &str) {
+ fn check(
+ #[rust_analyzer::rust_fixture] ra_fixture_before: &str,
+ #[rust_analyzer::rust_fixture] ra_fixture_after: &str,
+ ) {
check_assist(
remove_dbg,
&format!("fn main() {{\n{ra_fixture_before}\n}}"),
diff --git a/crates/ide-assists/src/tests.rs b/crates/ide-assists/src/tests.rs
index 85f1099ea5..48d2af6d3f 100644
--- a/crates/ide-assists/src/tests.rs
+++ b/crates/ide-assists/src/tests.rs
@@ -77,7 +77,11 @@ pub(crate) fn with_single_file(text: &str) -> (RootDatabase, EditionedFileId) {
}
#[track_caller]
-pub(crate) fn check_assist(assist: Handler, ra_fixture_before: &str, ra_fixture_after: &str) {
+pub(crate) fn check_assist(
+ assist: Handler,
+ #[rust_analyzer::rust_fixture] ra_fixture_before: &str,
+ #[rust_analyzer::rust_fixture] ra_fixture_after: &str,
+) {
let ra_fixture_after = trim_indent(ra_fixture_after);
check(assist, ra_fixture_before, ExpectedResult::After(&ra_fixture_after), None);
}
@@ -85,8 +89,8 @@ pub(crate) fn check_assist(assist: Handler, ra_fixture_before: &str, ra_fixture_
#[track_caller]
pub(crate) fn check_assist_no_snippet_cap(
assist: Handler,
- ra_fixture_before: &str,
- ra_fixture_after: &str,
+ #[rust_analyzer::rust_fixture] ra_fixture_before: &str,
+ #[rust_analyzer::rust_fixture] ra_fixture_after: &str,
) {
let ra_fixture_after = trim_indent(ra_fixture_after);
check_with_config(
@@ -101,8 +105,8 @@ pub(crate) fn check_assist_no_snippet_cap(
#[track_caller]
pub(crate) fn check_assist_import_one(
assist: Handler,
- ra_fixture_before: &str,
- ra_fixture_after: &str,
+ #[rust_analyzer::rust_fixture] ra_fixture_before: &str,
+ #[rust_analyzer::rust_fixture] ra_fixture_after: &str,
) {
let ra_fixture_after = trim_indent(ra_fixture_after);
check_with_config(
@@ -118,8 +122,8 @@ pub(crate) fn check_assist_import_one(
// so this is here to allow you choose.
pub(crate) fn check_assist_by_label(
assist: Handler,
- ra_fixture_before: &str,
- ra_fixture_after: &str,
+ #[rust_analyzer::rust_fixture] ra_fixture_before: &str,
+ #[rust_analyzer::rust_fixture] ra_fixture_after: &str,
label: &str,
) {
let ra_fixture_after = trim_indent(ra_fixture_after);
diff --git a/crates/ide-completion/src/tests.rs b/crates/ide-completion/src/tests.rs
index a37cf59485..b7dbf0a630 100644
--- a/crates/ide-completion/src/tests.rs
+++ b/crates/ide-completion/src/tests.rs
@@ -220,7 +220,11 @@ fn render_completion_list(completions: Vec<CompletionItem>) -> String {
}
#[track_caller]
-pub(crate) fn check_edit(what: &str, ra_fixture_before: &str, ra_fixture_after: &str) {
+pub(crate) fn check_edit(
+ what: &str,
+ #[rust_analyzer::rust_fixture] ra_fixture_before: &str,
+ #[rust_analyzer::rust_fixture] ra_fixture_after: &str,
+) {
check_edit_with_config(TEST_CONFIG, what, ra_fixture_before, ra_fixture_after)
}
diff --git a/crates/ide-db/src/imports/insert_use/tests.rs b/crates/ide-db/src/imports/insert_use/tests.rs
index 3e3aa266f7..decb0ea9d8 100644
--- a/crates/ide-db/src/imports/insert_use/tests.rs
+++ b/crates/ide-db/src/imports/insert_use/tests.rs
@@ -1244,8 +1244,8 @@ use ::ext::foo::Foo;
fn check_with_config(
path: &str,
- ra_fixture_before: &str,
- ra_fixture_after: &str,
+ #[rust_analyzer::rust_fixture] ra_fixture_before: &str,
+ #[rust_analyzer::rust_fixture] ra_fixture_after: &str,
config: &InsertUseConfig,
) {
let (db, file_id, pos) = if ra_fixture_before.contains(CURSOR_MARKER) {
@@ -1277,8 +1277,8 @@ fn check_with_config(
fn check(
path: &str,
- ra_fixture_before: &str,
- ra_fixture_after: &str,
+ #[rust_analyzer::rust_fixture] ra_fixture_before: &str,
+ #[rust_analyzer::rust_fixture] ra_fixture_after: &str,
granularity: ImportGranularity,
) {
check_with_config(
@@ -1295,19 +1295,35 @@ fn check(
)
}
-fn check_crate(path: &str, ra_fixture_before: &str, ra_fixture_after: &str) {
+fn check_crate(
+ path: &str,
+ #[rust_analyzer::rust_fixture] ra_fixture_before: &str,
+ #[rust_analyzer::rust_fixture] ra_fixture_after: &str,
+) {
check(path, ra_fixture_before, ra_fixture_after, ImportGranularity::Crate)
}
-fn check_module(path: &str, ra_fixture_before: &str, ra_fixture_after: &str) {
+fn check_module(
+ path: &str,
+ #[rust_analyzer::rust_fixture] ra_fixture_before: &str,
+ #[rust_analyzer::rust_fixture] ra_fixture_after: &str,
+) {
check(path, ra_fixture_before, ra_fixture_after, ImportGranularity::Module)
}
-fn check_none(path: &str, ra_fixture_before: &str, ra_fixture_after: &str) {
+fn check_none(
+ path: &str,
+ #[rust_analyzer::rust_fixture] ra_fixture_before: &str,
+ #[rust_analyzer::rust_fixture] ra_fixture_after: &str,
+) {
check(path, ra_fixture_before, ra_fixture_after, ImportGranularity::Item)
}
-fn check_one(path: &str, ra_fixture_before: &str, ra_fixture_after: &str) {
+fn check_one(
+ path: &str,
+ #[rust_analyzer::rust_fixture] ra_fixture_before: &str,
+ #[rust_analyzer::rust_fixture] ra_fixture_after: &str,
+) {
check(path, ra_fixture_before, ra_fixture_after, ImportGranularity::One)
}
diff --git a/crates/ide-diagnostics/src/tests.rs b/crates/ide-diagnostics/src/tests.rs
index 605a6f69fc..fc2a7db717 100644
--- a/crates/ide-diagnostics/src/tests.rs
+++ b/crates/ide-diagnostics/src/tests.rs
@@ -18,7 +18,10 @@ use crate::{DiagnosticsConfig, ExprFillDefaultMode, Severity};
/// * the first diagnostic fix trigger range touches the input cursor position
/// * that the contents of the file containing the cursor match `after` after the diagnostic fix is applied
#[track_caller]
-pub(crate) fn check_fix(ra_fixture_before: &str, ra_fixture_after: &str) {
+pub(crate) fn check_fix(
+ #[rust_analyzer::rust_fixture] ra_fixture_before: &str,
+ #[rust_analyzer::rust_fixture] ra_fixture_after: &str,
+) {
check_nth_fix(0, ra_fixture_before, ra_fixture_after);
}
/// Takes a multi-file input fixture with annotated cursor positions,
@@ -26,14 +29,21 @@ pub(crate) fn check_fix(ra_fixture_before: &str, ra_fixture_after: &str) {
/// * a diagnostic is produced
/// * every diagnostic fixes trigger range touches the input cursor position
/// * that the contents of the file containing the cursor match `after` after each diagnostic fix is applied
-pub(crate) fn check_fixes(ra_fixture_before: &str, ra_fixtures_after: Vec<&str>) {
+pub(crate) fn check_fixes(
+ #[rust_analyzer::rust_fixture] ra_fixture_before: &str,
+ ra_fixtures_after: Vec<&str>,
+) {
for (i, ra_fixture_after) in ra_fixtures_after.iter().enumerate() {
check_nth_fix(i, ra_fixture_before, ra_fixture_after)
}
}
#[track_caller]
-fn check_nth_fix(nth: usize, ra_fixture_before: &str, ra_fixture_after: &str) {
+fn check_nth_fix(
+ nth: usize,
+ #[rust_analyzer::rust_fixture] ra_fixture_before: &str,
+ #[rust_analyzer::rust_fixture] ra_fixture_after: &str,
+) {
let mut config = DiagnosticsConfig::test_sample();
config.expr_fill_default = ExprFillDefaultMode::Default;
check_nth_fix_with_config(config, nth, ra_fixture_before, ra_fixture_after)
@@ -41,8 +51,8 @@ fn check_nth_fix(nth: usize, ra_fixture_before: &str, ra_fixture_after: &str) {
#[track_caller]
pub(crate) fn check_fix_with_disabled(
- ra_fixture_before: &str,
- ra_fixture_after: &str,
+ #[rust_analyzer::rust_fixture] ra_fixture_before: &str,
+ #[rust_analyzer::rust_fixture] ra_fixture_after: &str,
disabled: impl Iterator<Item = String>,
) {
let mut config = DiagnosticsConfig::test_sample();
@@ -55,8 +65,8 @@ pub(crate) fn check_fix_with_disabled(
fn check_nth_fix_with_config(
config: DiagnosticsConfig,
nth: usize,
- ra_fixture_before: &str,
- ra_fixture_after: &str,
+ #[rust_analyzer::rust_fixture] ra_fixture_before: &str,
+ #[rust_analyzer::rust_fixture] ra_fixture_after: &str,
) {
let after = trim_indent(ra_fixture_after);
@@ -95,14 +105,20 @@ fn check_nth_fix_with_config(
assert_eq_text!(&after, &actual);
}
-pub(crate) fn check_fixes_unordered(ra_fixture_before: &str, ra_fixtures_after: Vec<&str>) {
+pub(crate) fn check_fixes_unordered(
+ #[rust_analyzer::rust_fixture] ra_fixture_before: &str,
+ ra_fixtures_after: Vec<&str>,
+) {
for ra_fixture_after in ra_fixtures_after.iter() {
check_has_fix(ra_fixture_before, ra_fixture_after)
}
}
#[track_caller]
-pub(crate) fn check_has_fix(ra_fixture_before: &str, ra_fixture_after: &str) {
+pub(crate) fn check_has_fix(
+ #[rust_analyzer::rust_fixture] ra_fixture_before: &str,
+ #[rust_analyzer::rust_fixture] ra_fixture_after: &str,
+) {
let after = trim_indent(ra_fixture_after);
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) {
}
#[track_caller]
-pub(crate) fn check_has_single_fix(ra_fixture_before: &str, ra_fixture_after: &str) {
+pub(crate) fn check_has_single_fix(
+ #[rust_analyzer::rust_fixture] ra_fixture_before: &str,
+ #[rust_analyzer::rust_fixture] ra_fixture_after: &str,
+) {
let after = trim_indent(ra_fixture_after);
let (db, file_position) = RootDatabase::with_position(ra_fixture_before);
diff --git a/crates/ide/src/join_lines.rs b/crates/ide/src/join_lines.rs
index 5192f91a4a..e4670177ec 100644
--- a/crates/ide/src/join_lines.rs
+++ b/crates/ide/src/join_lines.rs
@@ -307,7 +307,10 @@ mod tests {
use super::*;
- fn check_join_lines(ra_fixture_before: &str, ra_fixture_after: &str) {
+ fn check_join_lines(
+ #[rust_analyzer::rust_fixture] ra_fixture_before: &str,
+ #[rust_analyzer::rust_fixture] ra_fixture_after: &str,
+ ) {
let config = JoinLinesConfig {
join_else_if: true,
remove_trailing_comma: true,
@@ -333,7 +336,10 @@ mod tests {
assert_eq_text!(ra_fixture_after, &actual);
}
- fn check_join_lines_sel(ra_fixture_before: &str, ra_fixture_after: &str) {
+ fn check_join_lines_sel(
+ #[rust_analyzer::rust_fixture] ra_fixture_before: &str,
+ #[rust_analyzer::rust_fixture] ra_fixture_after: &str,
+ ) {
let config = JoinLinesConfig {
join_else_if: true,
remove_trailing_comma: true,
diff --git a/crates/ide/src/rename.rs b/crates/ide/src/rename.rs
index fdf8fe452b..ba739df309 100644
--- a/crates/ide/src/rename.rs
+++ b/crates/ide/src/rename.rs
@@ -456,7 +456,11 @@ mod tests {
use super::{RangeInfo, RenameError};
#[track_caller]
- fn check(new_name: &str, ra_fixture_before: &str, ra_fixture_after: &str) {
+ fn check(
+ new_name: &str,
+ #[rust_analyzer::rust_fixture] ra_fixture_before: &str,
+ #[rust_analyzer::rust_fixture] ra_fixture_after: &str,
+ ) {
let ra_fixture_after = &trim_indent(ra_fixture_after);
let (analysis, position) = fixture::position(ra_fixture_before);
if !ra_fixture_after.starts_with("error: ") {
diff --git a/crates/ide/src/typing.rs b/crates/ide/src/typing.rs
index 0ef9c4185b..47d75f1c95 100644
--- a/crates/ide/src/typing.rs
+++ b/crates/ide/src/typing.rs
@@ -436,14 +436,18 @@ mod tests {
})
}
- fn type_char(char_typed: char, ra_fixture_before: &str, ra_fixture_after: &str) {
+ fn type_char(
+ char_typed: char,
+ #[rust_analyzer::rust_fixture] ra_fixture_before: &str,
+ #[rust_analyzer::rust_fixture] ra_fixture_after: &str,
+ ) {
let actual = do_type_char(char_typed, ra_fixture_before)
.unwrap_or_else(|| panic!("typing `{char_typed}` did nothing"));
assert_eq_text!(ra_fixture_after, &actual);
}
- fn type_char_noop(char_typed: char, ra_fixture_before: &str) {
+ fn type_char_noop(char_typed: char, #[rust_analyzer::rust_fixture] ra_fixture_before: &str) {
let file_change = do_type_char(char_typed, ra_fixture_before);
assert_eq!(file_change, None)
}
diff --git a/crates/ide/src/typing/on_enter.rs b/crates/ide/src/typing/on_enter.rs
index 773e352220..e249c38c73 100644
--- a/crates/ide/src/typing/on_enter.rs
+++ b/crates/ide/src/typing/on_enter.rs
@@ -208,7 +208,10 @@ mod tests {
Some(actual)
}
- fn do_check(ra_fixture_before: &str, ra_fixture_after: &str) {
+ fn do_check(
+ #[rust_analyzer::rust_fixture] ra_fixture_before: &str,
+ #[rust_analyzer::rust_fixture] ra_fixture_after: &str,
+ ) {
let ra_fixture_after = &trim_indent(ra_fixture_after);
let actual = apply_on_enter(ra_fixture_before).unwrap();
assert_eq_text!(ra_fixture_after, &actual);