aboutsummaryrefslogtreecommitdiff
path: root/crates
diff options
context:
space:
mode:
Diffstat (limited to 'crates')
-rw-r--r--crates/expect/src/lib.rs4
-rw-r--r--crates/rust-analyzer/Cargo.toml1
-rw-r--r--crates/rust-analyzer/src/diagnostics/to_proto.rs120
-rw-r--r--crates/rust-analyzer/test_data/clippy_pass_by_ref.txt (renamed from crates/rust-analyzer/src/diagnostics/snapshots/rust_analyzer__diagnostics__to_proto__tests__snap_clippy_pass_by_ref.snap)4
-rw-r--r--crates/rust-analyzer/test_data/handles_macro_location.txt (renamed from crates/rust-analyzer/src/diagnostics/snapshots/rust_analyzer__diagnostics__to_proto__tests__snap_handles_macro_location.snap)4
-rw-r--r--crates/rust-analyzer/test_data/macro_compiler_error.txt (renamed from crates/rust-analyzer/src/diagnostics/snapshots/rust_analyzer__diagnostics__to_proto__tests__snap_macro_compiler_error.snap)4
-rw-r--r--crates/rust-analyzer/test_data/rustc_incompatible_type_for_trait.txt (renamed from crates/rust-analyzer/src/diagnostics/snapshots/rust_analyzer__diagnostics__to_proto__tests__snap_rustc_incompatible_type_for_trait.snap)4
-rw-r--r--crates/rust-analyzer/test_data/rustc_mismatched_type.txt (renamed from crates/rust-analyzer/src/diagnostics/snapshots/rust_analyzer__diagnostics__to_proto__tests__snap_rustc_mismatched_type.snap)4
-rw-r--r--crates/rust-analyzer/test_data/rustc_unused_variable.txt (renamed from crates/rust-analyzer/src/diagnostics/snapshots/rust_analyzer__diagnostics__to_proto__tests__snap_rustc_unused_variable.snap)4
-rw-r--r--crates/rust-analyzer/test_data/rustc_unused_variable_as_hint.txt (renamed from crates/rust-analyzer/src/diagnostics/snapshots/rust_analyzer__diagnostics__to_proto__tests__snap_rustc_unused_variable_as_hint.snap)4
-rw-r--r--crates/rust-analyzer/test_data/rustc_unused_variable_as_info.txt (renamed from crates/rust-analyzer/src/diagnostics/snapshots/rust_analyzer__diagnostics__to_proto__tests__snap_rustc_unused_variable_as_info.snap)4
-rw-r--r--crates/rust-analyzer/test_data/rustc_wrong_number_of_parameters.txt (renamed from crates/rust-analyzer/src/diagnostics/snapshots/rust_analyzer__diagnostics__to_proto__tests__snap_rustc_wrong_number_of_parameters.snap)4
-rw-r--r--crates/rust-analyzer/test_data/snap_multi_line_fix.txt (renamed from crates/rust-analyzer/src/diagnostics/snapshots/rust_analyzer__diagnostics__to_proto__tests__snap_multi_line_fix.snap)4
13 files changed, 53 insertions, 112 deletions
diff --git a/crates/expect/src/lib.rs b/crates/expect/src/lib.rs
index c54e99203..21a458d47 100644
--- a/crates/expect/src/lib.rs
+++ b/crates/expect/src/lib.rs
@@ -121,6 +121,10 @@ impl ExpectFile {
121 } 121 }
122 Runtime::fail_file(self, &expected, actual); 122 Runtime::fail_file(self, &expected, actual);
123 } 123 }
124 pub fn assert_debug_eq(&self, actual: &impl fmt::Debug) {
125 let actual = format!("{:#?}\n", actual);
126 self.assert_eq(&actual)
127 }
124 fn read(&self) -> String { 128 fn read(&self) -> String {
125 fs::read_to_string(self.abs_path()).unwrap_or_default().replace("\r\n", "\n") 129 fs::read_to_string(self.abs_path()).unwrap_or_default().replace("\r\n", "\n")
126 } 130 }
diff --git a/crates/rust-analyzer/Cargo.toml b/crates/rust-analyzer/Cargo.toml
index 0519884fd..dc8dbbe77 100644
--- a/crates/rust-analyzer/Cargo.toml
+++ b/crates/rust-analyzer/Cargo.toml
@@ -58,7 +58,6 @@ winapi = "0.3.8"
58 58
59[dev-dependencies] 59[dev-dependencies]
60tempfile = "3.1.0" 60tempfile = "3.1.0"
61insta = "0.16.0"
62expect = { path = "../expect" } 61expect = { path = "../expect" }
63test_utils = { path = "../test_utils" } 62test_utils = { path = "../test_utils" }
64mbe = { path = "../ra_mbe", package = "ra_mbe" } 63mbe = { path = "../ra_mbe", package = "ra_mbe" }
diff --git a/crates/rust-analyzer/src/diagnostics/to_proto.rs b/crates/rust-analyzer/src/diagnostics/to_proto.rs
index ded96c58a..808a23b17 100644
--- a/crates/rust-analyzer/src/diagnostics/to_proto.rs
+++ b/crates/rust-analyzer/src/diagnostics/to_proto.rs
@@ -256,13 +256,23 @@ pub(crate) fn map_rust_diagnostic_to_lsp(
256mod tests { 256mod tests {
257 use super::*; 257 use super::*;
258 258
259 fn parse_diagnostic(val: &str) -> flycheck::Diagnostic { 259 use expect::{expect_file, ExpectFile};
260 serde_json::from_str::<flycheck::Diagnostic>(val).unwrap() 260
261 // TODO: inlay hints config order
262 fn check(diagnostics_json: &str, expect: ExpectFile) {
263 check_with_config(DiagnosticsConfig::default(), diagnostics_json, expect)
264 }
265
266 fn check_with_config(config: DiagnosticsConfig, diagnostics_json: &str, expect: ExpectFile) {
267 let diagnostic: flycheck::Diagnostic = serde_json::from_str(diagnostics_json).unwrap();
268 let workspace_root = Path::new("/test/");
269 let actual = map_rust_diagnostic_to_lsp(&config, &diagnostic, workspace_root);
270 expect.assert_debug_eq(&actual)
261 } 271 }
262 272
263 #[test] 273 #[test]
264 fn snap_rustc_incompatible_type_for_trait() { 274 fn rustc_incompatible_type_for_trait() {
265 let diag = parse_diagnostic( 275 check(
266 r##"{ 276 r##"{
267 "message": "method `next` has an incompatible type for trait", 277 "message": "method `next` has an incompatible type for trait",
268 "code": { 278 "code": {
@@ -306,16 +316,13 @@ mod tests {
306 "rendered": "error[E0053]: method `next` has an incompatible type for trait\n --> compiler/ty/list_iter.rs:52:5\n |\n52 | fn next(&self) -> Option<&'list ty::Ref<M>> {\n | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ types differ in mutability\n |\n = note: expected type `fn(&mut ty::list_iter::ListIterator<'list, M>) -> std::option::Option<&ty::Ref<M>>`\n found type `fn(&ty::list_iter::ListIterator<'list, M>) -> std::option::Option<&'list ty::Ref<M>>`\n\n" 316 "rendered": "error[E0053]: method `next` has an incompatible type for trait\n --> compiler/ty/list_iter.rs:52:5\n |\n52 | fn next(&self) -> Option<&'list ty::Ref<M>> {\n | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ types differ in mutability\n |\n = note: expected type `fn(&mut ty::list_iter::ListIterator<'list, M>) -> std::option::Option<&ty::Ref<M>>`\n found type `fn(&ty::list_iter::ListIterator<'list, M>) -> std::option::Option<&'list ty::Ref<M>>`\n\n"
307 } 317 }
308 "##, 318 "##,
319 expect_file!["crates/rust-analyzer/test_data/rustc_incompatible_type_for_trait.txt"],
309 ); 320 );
310
311 let workspace_root = Path::new("/test/");
312 let diag = map_rust_diagnostic_to_lsp(&DiagnosticsConfig::default(), &diag, workspace_root);
313 insta::assert_debug_snapshot!(diag);
314 } 321 }
315 322
316 #[test] 323 #[test]
317 fn snap_rustc_unused_variable() { 324 fn rustc_unused_variable() {
318 let diag = parse_diagnostic( 325 check(
319 r##"{ 326 r##"{
320 "message": "unused variable: `foo`", 327 "message": "unused variable: `foo`",
321 "code": { 328 "code": {
@@ -388,17 +395,18 @@ mod tests {
388 ], 395 ],
389 "rendered": "warning: unused variable: `foo`\n --> driver/subcommand/repl.rs:291:9\n |\n291 | let foo = 42;\n | ^^^ help: consider prefixing with an underscore: `_foo`\n |\n = note: #[warn(unused_variables)] on by default\n\n" 396 "rendered": "warning: unused variable: `foo`\n --> driver/subcommand/repl.rs:291:9\n |\n291 | let foo = 42;\n | ^^^ help: consider prefixing with an underscore: `_foo`\n |\n = note: #[warn(unused_variables)] on by default\n\n"
390 }"##, 397 }"##,
398 expect_file!["crates/rust-analyzer/test_data/rustc_unused_variable.txt"],
391 ); 399 );
392
393 let workspace_root = Path::new("/test/");
394 let diag = map_rust_diagnostic_to_lsp(&DiagnosticsConfig::default(), &diag, workspace_root);
395 insta::assert_debug_snapshot!(diag);
396 } 400 }
397 401
398 #[test] 402 #[test]
399 #[cfg(not(windows))] 403 #[cfg(not(windows))]
400 fn snap_rustc_unused_variable_as_info() { 404 fn rustc_unused_variable_as_info() {
401 let diag = parse_diagnostic( 405 check_with_config(
406 DiagnosticsConfig {
407 warnings_as_info: vec!["unused_variables".to_string()],
408 ..DiagnosticsConfig::default()
409 },
402 r##"{ 410 r##"{
403 "message": "unused variable: `foo`", 411 "message": "unused variable: `foo`",
404 "code": { 412 "code": {
@@ -471,22 +479,18 @@ mod tests {
471 ], 479 ],
472 "rendered": "warning: unused variable: `foo`\n --> driver/subcommand/repl.rs:291:9\n |\n291 | let foo = 42;\n | ^^^ help: consider prefixing with an underscore: `_foo`\n |\n = note: #[warn(unused_variables)] on by default\n\n" 480 "rendered": "warning: unused variable: `foo`\n --> driver/subcommand/repl.rs:291:9\n |\n291 | let foo = 42;\n | ^^^ help: consider prefixing with an underscore: `_foo`\n |\n = note: #[warn(unused_variables)] on by default\n\n"
473 }"##, 481 }"##,
482 expect_file!["crates/rust-analyzer/test_data/rustc_unused_variable_as_info.txt"],
474 ); 483 );
475
476 let config = DiagnosticsConfig {
477 warnings_as_info: vec!["unused_variables".to_string()],
478 ..DiagnosticsConfig::default()
479 };
480
481 let workspace_root = Path::new("/test/");
482 let diag = map_rust_diagnostic_to_lsp(&config, &diag, workspace_root);
483 insta::assert_debug_snapshot!(diag);
484 } 484 }
485 485
486 #[test] 486 #[test]
487 #[cfg(not(windows))] 487 #[cfg(not(windows))]
488 fn snap_rustc_unused_variable_as_hint() { 488 fn rustc_unused_variable_as_hint() {
489 let diag = parse_diagnostic( 489 check_with_config(
490 DiagnosticsConfig {
491 warnings_as_hint: vec!["unused_variables".to_string()],
492 ..DiagnosticsConfig::default()
493 },
490 r##"{ 494 r##"{
491 "message": "unused variable: `foo`", 495 "message": "unused variable: `foo`",
492 "code": { 496 "code": {
@@ -559,21 +563,13 @@ mod tests {
559 ], 563 ],
560 "rendered": "warning: unused variable: `foo`\n --> driver/subcommand/repl.rs:291:9\n |\n291 | let foo = 42;\n | ^^^ help: consider prefixing with an underscore: `_foo`\n |\n = note: #[warn(unused_variables)] on by default\n\n" 564 "rendered": "warning: unused variable: `foo`\n --> driver/subcommand/repl.rs:291:9\n |\n291 | let foo = 42;\n | ^^^ help: consider prefixing with an underscore: `_foo`\n |\n = note: #[warn(unused_variables)] on by default\n\n"
561 }"##, 565 }"##,
566 expect_file!["crates/rust-analyzer/test_data/rustc_unused_variable_as_hint.txt"],
562 ); 567 );
563
564 let config = DiagnosticsConfig {
565 warnings_as_hint: vec!["unused_variables".to_string()],
566 ..DiagnosticsConfig::default()
567 };
568
569 let workspace_root = Path::new("/test/");
570 let diag = map_rust_diagnostic_to_lsp(&config, &diag, workspace_root);
571 insta::assert_debug_snapshot!(diag);
572 } 568 }
573 569
574 #[test] 570 #[test]
575 fn snap_rustc_wrong_number_of_parameters() { 571 fn rustc_wrong_number_of_parameters() {
576 let diag = parse_diagnostic( 572 check(
577 r##"{ 573 r##"{
578 "message": "this function takes 2 parameters but 3 parameters were supplied", 574 "message": "this function takes 2 parameters but 3 parameters were supplied",
579 "code": { 575 "code": {
@@ -688,16 +684,13 @@ mod tests {
688 "children": [], 684 "children": [],
689 "rendered": "error[E0061]: this function takes 2 parameters but 3 parameters were supplied\n --> compiler/ty/select.rs:104:18\n |\n104 | self.add_evidence(target_fixed, evidence_fixed, false);\n | ^^^^^^^^^^^^ expected 2 parameters\n...\n219 | / pub fn add_evidence(\n220 | | &mut self,\n221 | | target_poly: &ty::Ref<ty::Poly>,\n222 | | evidence_poly: &ty::Ref<ty::Poly>,\n... |\n230 | | }\n231 | | }\n | |_____- defined here\n\n" 685 "rendered": "error[E0061]: this function takes 2 parameters but 3 parameters were supplied\n --> compiler/ty/select.rs:104:18\n |\n104 | self.add_evidence(target_fixed, evidence_fixed, false);\n | ^^^^^^^^^^^^ expected 2 parameters\n...\n219 | / pub fn add_evidence(\n220 | | &mut self,\n221 | | target_poly: &ty::Ref<ty::Poly>,\n222 | | evidence_poly: &ty::Ref<ty::Poly>,\n... |\n230 | | }\n231 | | }\n | |_____- defined here\n\n"
690 }"##, 686 }"##,
687 expect_file!["crates/rust-analyzer/test_data/rustc_wrong_number_of_parameters.txt"],
691 ); 688 );
692
693 let workspace_root = Path::new("/test/");
694 let diag = map_rust_diagnostic_to_lsp(&DiagnosticsConfig::default(), &diag, workspace_root);
695 insta::assert_debug_snapshot!(diag);
696 } 689 }
697 690
698 #[test] 691 #[test]
699 fn snap_clippy_pass_by_ref() { 692 fn clippy_pass_by_ref() {
700 let diag = parse_diagnostic( 693 check(
701 r##"{ 694 r##"{
702 "message": "this argument is passed by reference, but would be more efficient if passed by value", 695 "message": "this argument is passed by reference, but would be more efficient if passed by value",
703 "code": { 696 "code": {
@@ -808,16 +801,13 @@ mod tests {
808 ], 801 ],
809 "rendered": "warning: this argument is passed by reference, but would be more efficient if passed by value\n --> compiler/mir/tagset.rs:42:24\n |\n42 | pub fn is_disjoint(&self, other: Self) -> bool {\n | ^^^^^ help: consider passing by value instead: `self`\n |\nnote: lint level defined here\n --> compiler/lib.rs:1:9\n |\n1 | #![warn(clippy::all)]\n | ^^^^^^^^^^^\n = note: #[warn(clippy::trivially_copy_pass_by_ref)] implied by #[warn(clippy::all)]\n = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#trivially_copy_pass_by_ref\n\n" 802 "rendered": "warning: this argument is passed by reference, but would be more efficient if passed by value\n --> compiler/mir/tagset.rs:42:24\n |\n42 | pub fn is_disjoint(&self, other: Self) -> bool {\n | ^^^^^ help: consider passing by value instead: `self`\n |\nnote: lint level defined here\n --> compiler/lib.rs:1:9\n |\n1 | #![warn(clippy::all)]\n | ^^^^^^^^^^^\n = note: #[warn(clippy::trivially_copy_pass_by_ref)] implied by #[warn(clippy::all)]\n = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#trivially_copy_pass_by_ref\n\n"
810 }"##, 803 }"##,
804 expect_file!["crates/rust-analyzer/test_data/clippy_pass_by_ref.txt"],
811 ); 805 );
812
813 let workspace_root = Path::new("/test/");
814 let diag = map_rust_diagnostic_to_lsp(&DiagnosticsConfig::default(), &diag, workspace_root);
815 insta::assert_debug_snapshot!(diag);
816 } 806 }
817 807
818 #[test] 808 #[test]
819 fn snap_rustc_mismatched_type() { 809 fn rustc_mismatched_type() {
820 let diag = parse_diagnostic( 810 check(
821 r##"{ 811 r##"{
822 "message": "mismatched types", 812 "message": "mismatched types",
823 "code": { 813 "code": {
@@ -851,16 +841,13 @@ mod tests {
851 "children": [], 841 "children": [],
852 "rendered": "error[E0308]: mismatched types\n --> runtime/compiler_support.rs:48:65\n |\n48 | let layout = alloc::Layout::from_size_align_unchecked(size, align);\n | ^^^^^ expected usize, found u32\n\n" 842 "rendered": "error[E0308]: mismatched types\n --> runtime/compiler_support.rs:48:65\n |\n48 | let layout = alloc::Layout::from_size_align_unchecked(size, align);\n | ^^^^^ expected usize, found u32\n\n"
853 }"##, 843 }"##,
844 expect_file!["crates/rust-analyzer/test_data/rustc_mismatched_type.txt"],
854 ); 845 );
855
856 let workspace_root = Path::new("/test/");
857 let diag = map_rust_diagnostic_to_lsp(&DiagnosticsConfig::default(), &diag, workspace_root);
858 insta::assert_debug_snapshot!(diag);
859 } 846 }
860 847
861 #[test] 848 #[test]
862 fn snap_handles_macro_location() { 849 fn handles_macro_location() {
863 let diag = parse_diagnostic( 850 check(
864 r##"{ 851 r##"{
865 "rendered": "error[E0277]: can't compare `{integer}` with `&str`\n --> src/main.rs:2:5\n |\n2 | assert_eq!(1, \"love\");\n | ^^^^^^^^^^^^^^^^^^^^^^ no implementation for `{integer} == &str`\n |\n = help: the trait `std::cmp::PartialEq<&str>` is not implemented for `{integer}`\n = note: this error originates in a macro outside of the current crate (in Nightly builds, run with -Z external-macro-backtrace for more info)\n\n", 852 "rendered": "error[E0277]: can't compare `{integer}` with `&str`\n --> src/main.rs:2:5\n |\n2 | assert_eq!(1, \"love\");\n | ^^^^^^^^^^^^^^^^^^^^^^ no implementation for `{integer} == &str`\n |\n = help: the trait `std::cmp::PartialEq<&str>` is not implemented for `{integer}`\n = note: this error originates in a macro outside of the current crate (in Nightly builds, run with -Z external-macro-backtrace for more info)\n\n",
866 "children": [ 853 "children": [
@@ -1122,16 +1109,13 @@ mod tests {
1122 } 1109 }
1123 ] 1110 ]
1124 }"##, 1111 }"##,
1112 expect_file!["crates/rust-analyzer/test_data/handles_macro_location.txt"],
1125 ); 1113 );
1126
1127 let workspace_root = Path::new("/test/");
1128 let diag = map_rust_diagnostic_to_lsp(&DiagnosticsConfig::default(), &diag, workspace_root);
1129 insta::assert_debug_snapshot!(diag);
1130 } 1114 }
1131 1115
1132 #[test] 1116 #[test]
1133 fn snap_macro_compiler_error() { 1117 fn macro_compiler_error() {
1134 let diag = parse_diagnostic( 1118 check(
1135 r##"{ 1119 r##"{
1136 "rendered": "error: Please register your known path in the path module\n --> crates/ra_hir_def/src/path.rs:265:9\n |\n265 | compile_error!(\"Please register your known path in the path module\")\n | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n | \n ::: crates/ra_hir_def/src/data.rs:80:16\n |\n80 | let path = path![std::future::Future];\n | -------------------------- in this macro invocation\n\n", 1120 "rendered": "error: Please register your known path in the path module\n --> crates/ra_hir_def/src/path.rs:265:9\n |\n265 | compile_error!(\"Please register your known path in the path module\")\n | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n | \n ::: crates/ra_hir_def/src/data.rs:80:16\n |\n80 | let path = path![std::future::Future];\n | -------------------------- in this macro invocation\n\n",
1137 "children": [], 1121 "children": [],
@@ -1351,16 +1335,13 @@ mod tests {
1351 ] 1335 ]
1352 } 1336 }
1353 "##, 1337 "##,
1338 expect_file!["crates/rust-analyzer/test_data/macro_compiler_error.txt"],
1354 ); 1339 );
1355
1356 let workspace_root = Path::new("/test/");
1357 let diag = map_rust_diagnostic_to_lsp(&DiagnosticsConfig::default(), &diag, workspace_root);
1358 insta::assert_debug_snapshot!(diag);
1359 } 1340 }
1360 1341
1361 #[test] 1342 #[test]
1362 fn snap_multi_line_fix() { 1343 fn snap_multi_line_fix() {
1363 let diag = parse_diagnostic( 1344 check(
1364 r##"{ 1345 r##"{
1365 "rendered": "warning: returning the result of a let binding from a block\n --> src/main.rs:4:5\n |\n3 | let a = (0..10).collect();\n | -------------------------- unnecessary let binding\n4 | a\n | ^\n |\n = note: `#[warn(clippy::let_and_return)]` on by default\n = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#let_and_return\nhelp: return the expression directly\n |\n3 | \n4 | (0..10).collect()\n |\n\n", 1346 "rendered": "warning: returning the result of a let binding from a block\n --> src/main.rs:4:5\n |\n3 | let a = (0..10).collect();\n | -------------------------- unnecessary let binding\n4 | a\n | ^\n |\n = note: `#[warn(clippy::let_and_return)]` on by default\n = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#let_and_return\nhelp: return the expression directly\n |\n3 | \n4 | (0..10).collect()\n |\n\n",
1366 "children": [ 1347 "children": [
@@ -1484,10 +1465,7 @@ mod tests {
1484 ] 1465 ]
1485 } 1466 }
1486 "##, 1467 "##,
1468 expect_file!["crates/rust-analyzer/test_data/snap_multi_line_fix.txt"],
1487 ); 1469 );
1488
1489 let workspace_root = Path::new("/test/");
1490 let diag = map_rust_diagnostic_to_lsp(&DiagnosticsConfig::default(), &diag, workspace_root);
1491 insta::assert_debug_snapshot!(diag);
1492 } 1470 }
1493} 1471}
diff --git a/crates/rust-analyzer/src/diagnostics/snapshots/rust_analyzer__diagnostics__to_proto__tests__snap_clippy_pass_by_ref.snap b/crates/rust-analyzer/test_data/clippy_pass_by_ref.txt
index 578b1e128..d06517126 100644
--- a/crates/rust-analyzer/src/diagnostics/snapshots/rust_analyzer__diagnostics__to_proto__tests__snap_clippy_pass_by_ref.snap
+++ b/crates/rust-analyzer/test_data/clippy_pass_by_ref.txt
@@ -1,7 +1,3 @@
1---
2source: crates/rust-analyzer/src/diagnostics/to_proto.rs
3expression: diag
4---
5[ 1[
6 MappedRustDiagnostic { 2 MappedRustDiagnostic {
7 url: "file:///test/compiler/mir/tagset.rs", 3 url: "file:///test/compiler/mir/tagset.rs",
diff --git a/crates/rust-analyzer/src/diagnostics/snapshots/rust_analyzer__diagnostics__to_proto__tests__snap_handles_macro_location.snap b/crates/rust-analyzer/test_data/handles_macro_location.txt
index 577cf4b2d..f5de2f07f 100644
--- a/crates/rust-analyzer/src/diagnostics/snapshots/rust_analyzer__diagnostics__to_proto__tests__snap_handles_macro_location.snap
+++ b/crates/rust-analyzer/test_data/handles_macro_location.txt
@@ -1,7 +1,3 @@
1---
2source: crates/rust-analyzer/src/diagnostics/to_proto.rs
3expression: diag
4---
5[ 1[
6 MappedRustDiagnostic { 2 MappedRustDiagnostic {
7 url: "file:///test/src/main.rs", 3 url: "file:///test/src/main.rs",
diff --git a/crates/rust-analyzer/src/diagnostics/snapshots/rust_analyzer__diagnostics__to_proto__tests__snap_macro_compiler_error.snap b/crates/rust-analyzer/test_data/macro_compiler_error.txt
index 22bd23a88..f695db73c 100644
--- a/crates/rust-analyzer/src/diagnostics/snapshots/rust_analyzer__diagnostics__to_proto__tests__snap_macro_compiler_error.snap
+++ b/crates/rust-analyzer/test_data/macro_compiler_error.txt
@@ -1,7 +1,3 @@
1---
2source: crates/rust-analyzer/src/diagnostics/to_proto.rs
3expression: diag
4---
5[ 1[
6 MappedRustDiagnostic { 2 MappedRustDiagnostic {
7 url: "file:///test/crates/ra_hir_def/src/data.rs", 3 url: "file:///test/crates/ra_hir_def/src/data.rs",
diff --git a/crates/rust-analyzer/src/diagnostics/snapshots/rust_analyzer__diagnostics__to_proto__tests__snap_rustc_incompatible_type_for_trait.snap b/crates/rust-analyzer/test_data/rustc_incompatible_type_for_trait.txt
index cc608dafe..fc54440be 100644
--- a/crates/rust-analyzer/src/diagnostics/snapshots/rust_analyzer__diagnostics__to_proto__tests__snap_rustc_incompatible_type_for_trait.snap
+++ b/crates/rust-analyzer/test_data/rustc_incompatible_type_for_trait.txt
@@ -1,7 +1,3 @@
1---
2source: crates/rust-analyzer/src/diagnostics/to_proto.rs
3expression: diag
4---
5[ 1[
6 MappedRustDiagnostic { 2 MappedRustDiagnostic {
7 url: "file:///test/compiler/ty/list_iter.rs", 3 url: "file:///test/compiler/ty/list_iter.rs",
diff --git a/crates/rust-analyzer/src/diagnostics/snapshots/rust_analyzer__diagnostics__to_proto__tests__snap_rustc_mismatched_type.snap b/crates/rust-analyzer/test_data/rustc_mismatched_type.txt
index 4d2a8625e..c269af218 100644
--- a/crates/rust-analyzer/src/diagnostics/snapshots/rust_analyzer__diagnostics__to_proto__tests__snap_rustc_mismatched_type.snap
+++ b/crates/rust-analyzer/test_data/rustc_mismatched_type.txt
@@ -1,7 +1,3 @@
1---
2source: crates/rust-analyzer/src/diagnostics/to_proto.rs
3expression: diag
4---
5[ 1[
6 MappedRustDiagnostic { 2 MappedRustDiagnostic {
7 url: "file:///test/runtime/compiler_support.rs", 3 url: "file:///test/runtime/compiler_support.rs",
diff --git a/crates/rust-analyzer/src/diagnostics/snapshots/rust_analyzer__diagnostics__to_proto__tests__snap_rustc_unused_variable.snap b/crates/rust-analyzer/test_data/rustc_unused_variable.txt
index e35941c76..81f180a86 100644
--- a/crates/rust-analyzer/src/diagnostics/snapshots/rust_analyzer__diagnostics__to_proto__tests__snap_rustc_unused_variable.snap
+++ b/crates/rust-analyzer/test_data/rustc_unused_variable.txt
@@ -1,7 +1,3 @@
1---
2source: crates/rust-analyzer/src/diagnostics/to_proto.rs
3expression: diag
4---
5[ 1[
6 MappedRustDiagnostic { 2 MappedRustDiagnostic {
7 url: "file:///test/driver/subcommand/repl.rs", 3 url: "file:///test/driver/subcommand/repl.rs",
diff --git a/crates/rust-analyzer/src/diagnostics/snapshots/rust_analyzer__diagnostics__to_proto__tests__snap_rustc_unused_variable_as_hint.snap b/crates/rust-analyzer/test_data/rustc_unused_variable_as_hint.txt
index b6a7bcf60..d5d78fd80 100644
--- a/crates/rust-analyzer/src/diagnostics/snapshots/rust_analyzer__diagnostics__to_proto__tests__snap_rustc_unused_variable_as_hint.snap
+++ b/crates/rust-analyzer/test_data/rustc_unused_variable_as_hint.txt
@@ -1,7 +1,3 @@
1---
2source: crates/rust-analyzer/src/diagnostics/to_proto.rs
3expression: diag
4---
5[ 1[
6 MappedRustDiagnostic { 2 MappedRustDiagnostic {
7 url: "file:///test/driver/subcommand/repl.rs", 3 url: "file:///test/driver/subcommand/repl.rs",
diff --git a/crates/rust-analyzer/src/diagnostics/snapshots/rust_analyzer__diagnostics__to_proto__tests__snap_rustc_unused_variable_as_info.snap b/crates/rust-analyzer/test_data/rustc_unused_variable_as_info.txt
index 8c248faf2..2a7505c59 100644
--- a/crates/rust-analyzer/src/diagnostics/snapshots/rust_analyzer__diagnostics__to_proto__tests__snap_rustc_unused_variable_as_info.snap
+++ b/crates/rust-analyzer/test_data/rustc_unused_variable_as_info.txt
@@ -1,7 +1,3 @@
1---
2source: crates/rust-analyzer/src/diagnostics/to_proto.rs
3expression: diag
4---
5[ 1[
6 MappedRustDiagnostic { 2 MappedRustDiagnostic {
7 url: "file:///test/driver/subcommand/repl.rs", 3 url: "file:///test/driver/subcommand/repl.rs",
diff --git a/crates/rust-analyzer/src/diagnostics/snapshots/rust_analyzer__diagnostics__to_proto__tests__snap_rustc_wrong_number_of_parameters.snap b/crates/rust-analyzer/test_data/rustc_wrong_number_of_parameters.txt
index 3ece40eaf..efe37261d 100644
--- a/crates/rust-analyzer/src/diagnostics/snapshots/rust_analyzer__diagnostics__to_proto__tests__snap_rustc_wrong_number_of_parameters.snap
+++ b/crates/rust-analyzer/test_data/rustc_wrong_number_of_parameters.txt
@@ -1,7 +1,3 @@
1---
2source: crates/rust-analyzer/src/diagnostics/to_proto.rs
3expression: diag
4---
5[ 1[
6 MappedRustDiagnostic { 2 MappedRustDiagnostic {
7 url: "file:///test/compiler/ty/select.rs", 3 url: "file:///test/compiler/ty/select.rs",
diff --git a/crates/rust-analyzer/src/diagnostics/snapshots/rust_analyzer__diagnostics__to_proto__tests__snap_multi_line_fix.snap b/crates/rust-analyzer/test_data/snap_multi_line_fix.txt
index 1a0ac4f42..6eca3ae2f 100644
--- a/crates/rust-analyzer/src/diagnostics/snapshots/rust_analyzer__diagnostics__to_proto__tests__snap_multi_line_fix.snap
+++ b/crates/rust-analyzer/test_data/snap_multi_line_fix.txt
@@ -1,7 +1,3 @@
1---
2source: crates/rust-analyzer/src/diagnostics/to_proto.rs
3expression: diag
4---
5[ 1[
6 MappedRustDiagnostic { 2 MappedRustDiagnostic {
7 url: "file:///test/src/main.rs", 3 url: "file:///test/src/main.rs",