aboutsummaryrefslogtreecommitdiff
path: root/crates/ra_cargo_watch/src/conv/test.rs
diff options
context:
space:
mode:
Diffstat (limited to 'crates/ra_cargo_watch/src/conv/test.rs')
-rw-r--r--crates/ra_cargo_watch/src/conv/test.rs698
1 files changed, 698 insertions, 0 deletions
diff --git a/crates/ra_cargo_watch/src/conv/test.rs b/crates/ra_cargo_watch/src/conv/test.rs
new file mode 100644
index 000000000..69a07be11
--- /dev/null
+++ b/crates/ra_cargo_watch/src/conv/test.rs
@@ -0,0 +1,698 @@
1use crate::*;
2
3fn parse_diagnostic(val: &str) -> cargo_metadata::diagnostic::Diagnostic {
4 serde_json::from_str::<cargo_metadata::diagnostic::Diagnostic>(val).unwrap()
5}
6
7#[test]
8fn snap_rustc_incompatible_type_for_trait() {
9 let diag = parse_diagnostic(
10 r##"{
11 "message": "method `next` has an incompatible type for trait",
12 "code": {
13 "code": "E0053",
14 "explanation": "\nThe parameters of any trait method must match between a trait implementation\nand the trait definition.\n\nHere are a couple examples of this error:\n\n```compile_fail,E0053\ntrait Foo {\n fn foo(x: u16);\n fn bar(&self);\n}\n\nstruct Bar;\n\nimpl Foo for Bar {\n // error, expected u16, found i16\n fn foo(x: i16) { }\n\n // error, types differ in mutability\n fn bar(&mut self) { }\n}\n```\n"
15 },
16 "level": "error",
17 "spans": [
18 {
19 "file_name": "compiler/ty/list_iter.rs",
20 "byte_start": 1307,
21 "byte_end": 1350,
22 "line_start": 52,
23 "line_end": 52,
24 "column_start": 5,
25 "column_end": 48,
26 "is_primary": true,
27 "text": [
28 {
29 "text": " fn next(&self) -> Option<&'list ty::Ref<M>> {",
30 "highlight_start": 5,
31 "highlight_end": 48
32 }
33 ],
34 "label": "types differ in mutability",
35 "suggested_replacement": null,
36 "suggestion_applicability": null,
37 "expansion": null
38 }
39 ],
40 "children": [
41 {
42 "message": "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>>`",
43 "code": null,
44 "level": "note",
45 "spans": [],
46 "children": [],
47 "rendered": null
48 }
49 ],
50 "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"
51 }
52 "##,
53 );
54
55 let workspace_root = PathBuf::from("/test/");
56 let diag = map_rust_diagnostic_to_lsp(&diag, &workspace_root).expect("couldn't map diagnostic");
57 insta::assert_debug_snapshot!(diag);
58}
59
60#[test]
61fn snap_rustc_unused_variable() {
62 let diag = parse_diagnostic(
63 r##"{
64"message": "unused variable: `foo`",
65"code": {
66 "code": "unused_variables",
67 "explanation": null
68},
69"level": "warning",
70"spans": [
71 {
72 "file_name": "driver/subcommand/repl.rs",
73 "byte_start": 9228,
74 "byte_end": 9231,
75 "line_start": 291,
76 "line_end": 291,
77 "column_start": 9,
78 "column_end": 12,
79 "is_primary": true,
80 "text": [
81 {
82 "text": " let foo = 42;",
83 "highlight_start": 9,
84 "highlight_end": 12
85 }
86 ],
87 "label": null,
88 "suggested_replacement": null,
89 "suggestion_applicability": null,
90 "expansion": null
91 }
92],
93"children": [
94 {
95 "message": "#[warn(unused_variables)] on by default",
96 "code": null,
97 "level": "note",
98 "spans": [],
99 "children": [],
100 "rendered": null
101 },
102 {
103 "message": "consider prefixing with an underscore",
104 "code": null,
105 "level": "help",
106 "spans": [
107 {
108 "file_name": "driver/subcommand/repl.rs",
109 "byte_start": 9228,
110 "byte_end": 9231,
111 "line_start": 291,
112 "line_end": 291,
113 "column_start": 9,
114 "column_end": 12,
115 "is_primary": true,
116 "text": [
117 {
118 "text": " let foo = 42;",
119 "highlight_start": 9,
120 "highlight_end": 12
121 }
122 ],
123 "label": null,
124 "suggested_replacement": "_foo",
125 "suggestion_applicability": "MachineApplicable",
126 "expansion": null
127 }
128 ],
129 "children": [],
130 "rendered": null
131 }
132],
133"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"
134}"##,
135 );
136
137 let workspace_root = PathBuf::from("/test/");
138 let diag = map_rust_diagnostic_to_lsp(&diag, &workspace_root).expect("couldn't map diagnostic");
139 insta::assert_debug_snapshot!(diag);
140}
141
142#[test]
143fn snap_rustc_wrong_number_of_parameters() {
144 let diag = parse_diagnostic(
145 r##"{
146"message": "this function takes 2 parameters but 3 parameters were supplied",
147"code": {
148 "code": "E0061",
149 "explanation": "\nThe number of arguments passed to a function must match the number of arguments\nspecified in the function signature.\n\nFor example, a function like:\n\n```\nfn f(a: u16, b: &str) {}\n```\n\nMust always be called with exactly two arguments, e.g., `f(2, \"test\")`.\n\nNote that Rust does not have a notion of optional function arguments or\nvariadic functions (except for its C-FFI).\n"
150},
151"level": "error",
152"spans": [
153 {
154 "file_name": "compiler/ty/select.rs",
155 "byte_start": 8787,
156 "byte_end": 9241,
157 "line_start": 219,
158 "line_end": 231,
159 "column_start": 5,
160 "column_end": 6,
161 "is_primary": false,
162 "text": [
163 {
164 "text": " pub fn add_evidence(",
165 "highlight_start": 5,
166 "highlight_end": 25
167 },
168 {
169 "text": " &mut self,",
170 "highlight_start": 1,
171 "highlight_end": 19
172 },
173 {
174 "text": " target_poly: &ty::Ref<ty::Poly>,",
175 "highlight_start": 1,
176 "highlight_end": 41
177 },
178 {
179 "text": " evidence_poly: &ty::Ref<ty::Poly>,",
180 "highlight_start": 1,
181 "highlight_end": 43
182 },
183 {
184 "text": " ) {",
185 "highlight_start": 1,
186 "highlight_end": 8
187 },
188 {
189 "text": " match target_poly {",
190 "highlight_start": 1,
191 "highlight_end": 28
192 },
193 {
194 "text": " ty::Ref::Var(tvar, _) => self.add_var_evidence(tvar, evidence_poly),",
195 "highlight_start": 1,
196 "highlight_end": 81
197 },
198 {
199 "text": " ty::Ref::Fixed(target_ty) => {",
200 "highlight_start": 1,
201 "highlight_end": 43
202 },
203 {
204 "text": " let evidence_ty = evidence_poly.resolve_to_ty();",
205 "highlight_start": 1,
206 "highlight_end": 65
207 },
208 {
209 "text": " self.add_evidence_ty(target_ty, evidence_poly, evidence_ty)",
210 "highlight_start": 1,
211 "highlight_end": 76
212 },
213 {
214 "text": " }",
215 "highlight_start": 1,
216 "highlight_end": 14
217 },
218 {
219 "text": " }",
220 "highlight_start": 1,
221 "highlight_end": 10
222 },
223 {
224 "text": " }",
225 "highlight_start": 1,
226 "highlight_end": 6
227 }
228 ],
229 "label": "defined here",
230 "suggested_replacement": null,
231 "suggestion_applicability": null,
232 "expansion": null
233 },
234 {
235 "file_name": "compiler/ty/select.rs",
236 "byte_start": 4045,
237 "byte_end": 4057,
238 "line_start": 104,
239 "line_end": 104,
240 "column_start": 18,
241 "column_end": 30,
242 "is_primary": true,
243 "text": [
244 {
245 "text": " self.add_evidence(target_fixed, evidence_fixed, false);",
246 "highlight_start": 18,
247 "highlight_end": 30
248 }
249 ],
250 "label": "expected 2 parameters",
251 "suggested_replacement": null,
252 "suggestion_applicability": null,
253 "expansion": null
254 }
255],
256"children": [],
257"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"
258}"##,
259 );
260
261 let workspace_root = PathBuf::from("/test/");
262 let diag = map_rust_diagnostic_to_lsp(&diag, &workspace_root).expect("couldn't map diagnostic");
263 insta::assert_debug_snapshot!(diag);
264}
265
266#[test]
267fn snap_clippy_pass_by_ref() {
268 let diag = parse_diagnostic(
269 r##"{
270"message": "this argument is passed by reference, but would be more efficient if passed by value",
271"code": {
272 "code": "clippy::trivially_copy_pass_by_ref",
273 "explanation": null
274},
275"level": "warning",
276"spans": [
277 {
278 "file_name": "compiler/mir/tagset.rs",
279 "byte_start": 941,
280 "byte_end": 946,
281 "line_start": 42,
282 "line_end": 42,
283 "column_start": 24,
284 "column_end": 29,
285 "is_primary": true,
286 "text": [
287 {
288 "text": " pub fn is_disjoint(&self, other: Self) -> bool {",
289 "highlight_start": 24,
290 "highlight_end": 29
291 }
292 ],
293 "label": null,
294 "suggested_replacement": null,
295 "suggestion_applicability": null,
296 "expansion": null
297 }
298],
299"children": [
300 {
301 "message": "lint level defined here",
302 "code": null,
303 "level": "note",
304 "spans": [
305 {
306 "file_name": "compiler/lib.rs",
307 "byte_start": 8,
308 "byte_end": 19,
309 "line_start": 1,
310 "line_end": 1,
311 "column_start": 9,
312 "column_end": 20,
313 "is_primary": true,
314 "text": [
315 {
316 "text": "#![warn(clippy::all)]",
317 "highlight_start": 9,
318 "highlight_end": 20
319 }
320 ],
321 "label": null,
322 "suggested_replacement": null,
323 "suggestion_applicability": null,
324 "expansion": null
325 }
326 ],
327 "children": [],
328 "rendered": null
329 },
330 {
331 "message": "#[warn(clippy::trivially_copy_pass_by_ref)] implied by #[warn(clippy::all)]",
332 "code": null,
333 "level": "note",
334 "spans": [],
335 "children": [],
336 "rendered": null
337 },
338 {
339 "message": "for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#trivially_copy_pass_by_ref",
340 "code": null,
341 "level": "help",
342 "spans": [],
343 "children": [],
344 "rendered": null
345 },
346 {
347 "message": "consider passing by value instead",
348 "code": null,
349 "level": "help",
350 "spans": [
351 {
352 "file_name": "compiler/mir/tagset.rs",
353 "byte_start": 941,
354 "byte_end": 946,
355 "line_start": 42,
356 "line_end": 42,
357 "column_start": 24,
358 "column_end": 29,
359 "is_primary": true,
360 "text": [
361 {
362 "text": " pub fn is_disjoint(&self, other: Self) -> bool {",
363 "highlight_start": 24,
364 "highlight_end": 29
365 }
366 ],
367 "label": null,
368 "suggested_replacement": "self",
369 "suggestion_applicability": "Unspecified",
370 "expansion": null
371 }
372 ],
373 "children": [],
374 "rendered": null
375 }
376],
377"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"
378}"##,
379 );
380
381 let workspace_root = PathBuf::from("/test/");
382 let diag = map_rust_diagnostic_to_lsp(&diag, &workspace_root).expect("couldn't map diagnostic");
383 insta::assert_debug_snapshot!(diag);
384}
385
386#[test]
387fn snap_rustc_mismatched_type() {
388 let diag = parse_diagnostic(
389 r##"{
390"message": "mismatched types",
391"code": {
392 "code": "E0308",
393 "explanation": "\nThis error occurs when the compiler was unable to infer the concrete type of a\nvariable. It can occur for several cases, the most common of which is a\nmismatch in the expected type that the compiler inferred for a variable's\ninitializing expression, and the actual type explicitly assigned to the\nvariable.\n\nFor example:\n\n```compile_fail,E0308\nlet x: i32 = \"I am not a number!\";\n// ~~~ ~~~~~~~~~~~~~~~~~~~~\n// | |\n// | initializing expression;\n// | compiler infers type `&str`\n// |\n// type `i32` assigned to variable `x`\n```\n"
394},
395"level": "error",
396"spans": [
397 {
398 "file_name": "runtime/compiler_support.rs",
399 "byte_start": 1589,
400 "byte_end": 1594,
401 "line_start": 48,
402 "line_end": 48,
403 "column_start": 65,
404 "column_end": 70,
405 "is_primary": true,
406 "text": [
407 {
408 "text": " let layout = alloc::Layout::from_size_align_unchecked(size, align);",
409 "highlight_start": 65,
410 "highlight_end": 70
411 }
412 ],
413 "label": "expected usize, found u32",
414 "suggested_replacement": null,
415 "suggestion_applicability": null,
416 "expansion": null
417 }
418],
419"children": [],
420"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"
421}"##,
422 );
423
424 let workspace_root = PathBuf::from("/test/");
425 let diag = map_rust_diagnostic_to_lsp(&diag, &workspace_root).expect("couldn't map diagnostic");
426 insta::assert_debug_snapshot!(diag);
427}
428
429#[test]
430fn snap_handles_macro_location() {
431 let diag = parse_diagnostic(
432 r##"{
433"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",
434"children": [
435 {
436 "children": [],
437 "code": null,
438 "level": "help",
439 "message": "the trait `std::cmp::PartialEq<&str>` is not implemented for `{integer}`",
440 "rendered": null,
441 "spans": []
442 }
443],
444"code": {
445 "code": "E0277",
446 "explanation": "\nYou tried to use a type which doesn't implement some trait in a place which\nexpected that trait. Erroneous code example:\n\n```compile_fail,E0277\n// here we declare the Foo trait with a bar method\ntrait Foo {\n fn bar(&self);\n}\n\n// we now declare a function which takes an object implementing the Foo trait\nfn some_func<T: Foo>(foo: T) {\n foo.bar();\n}\n\nfn main() {\n // we now call the method with the i32 type, which doesn't implement\n // the Foo trait\n some_func(5i32); // error: the trait bound `i32 : Foo` is not satisfied\n}\n```\n\nIn order to fix this error, verify that the type you're using does implement\nthe trait. Example:\n\n```\ntrait Foo {\n fn bar(&self);\n}\n\nfn some_func<T: Foo>(foo: T) {\n foo.bar(); // we can now use this method since i32 implements the\n // Foo trait\n}\n\n// we implement the trait on the i32 type\nimpl Foo for i32 {\n fn bar(&self) {}\n}\n\nfn main() {\n some_func(5i32); // ok!\n}\n```\n\nOr in a generic context, an erroneous code example would look like:\n\n```compile_fail,E0277\nfn some_func<T>(foo: T) {\n println!(\"{:?}\", foo); // error: the trait `core::fmt::Debug` is not\n // implemented for the type `T`\n}\n\nfn main() {\n // We now call the method with the i32 type,\n // which *does* implement the Debug trait.\n some_func(5i32);\n}\n```\n\nNote that the error here is in the definition of the generic function: Although\nwe only call it with a parameter that does implement `Debug`, the compiler\nstill rejects the function: It must work with all possible input types. In\norder to make this example compile, we need to restrict the generic type we're\naccepting:\n\n```\nuse std::fmt;\n\n// Restrict the input type to types that implement Debug.\nfn some_func<T: fmt::Debug>(foo: T) {\n println!(\"{:?}\", foo);\n}\n\nfn main() {\n // Calling the method is still fine, as i32 implements Debug.\n some_func(5i32);\n\n // This would fail to compile now:\n // struct WithoutDebug;\n // some_func(WithoutDebug);\n}\n```\n\nRust only looks at the signature of the called function, as such it must\nalready specify all requirements that will be used for every type parameter.\n"
447},
448"level": "error",
449"message": "can't compare `{integer}` with `&str`",
450"spans": [
451 {
452 "byte_end": 155,
453 "byte_start": 153,
454 "column_end": 33,
455 "column_start": 31,
456 "expansion": {
457 "def_site_span": {
458 "byte_end": 940,
459 "byte_start": 0,
460 "column_end": 6,
461 "column_start": 1,
462 "expansion": null,
463 "file_name": "<::core::macros::assert_eq macros>",
464 "is_primary": false,
465 "label": null,
466 "line_end": 36,
467 "line_start": 1,
468 "suggested_replacement": null,
469 "suggestion_applicability": null,
470 "text": [
471 {
472 "highlight_end": 35,
473 "highlight_start": 1,
474 "text": "($ left : expr, $ right : expr) =>"
475 },
476 {
477 "highlight_end": 3,
478 "highlight_start": 1,
479 "text": "({"
480 },
481 {
482 "highlight_end": 33,
483 "highlight_start": 1,
484 "text": " match (& $ left, & $ right)"
485 },
486 {
487 "highlight_end": 7,
488 "highlight_start": 1,
489 "text": " {"
490 },
491 {
492 "highlight_end": 34,
493 "highlight_start": 1,
494 "text": " (left_val, right_val) =>"
495 },
496 {
497 "highlight_end": 11,
498 "highlight_start": 1,
499 "text": " {"
500 },
501 {
502 "highlight_end": 46,
503 "highlight_start": 1,
504 "text": " if ! (* left_val == * right_val)"
505 },
506 {
507 "highlight_end": 15,
508 "highlight_start": 1,
509 "text": " {"
510 },
511 {
512 "highlight_end": 25,
513 "highlight_start": 1,
514 "text": " panic !"
515 },
516 {
517 "highlight_end": 57,
518 "highlight_start": 1,
519 "text": " (r#\"assertion failed: `(left == right)`"
520 },
521 {
522 "highlight_end": 16,
523 "highlight_start": 1,
524 "text": " left: `{:?}`,"
525 },
526 {
527 "highlight_end": 18,
528 "highlight_start": 1,
529 "text": " right: `{:?}`\"#,"
530 },
531 {
532 "highlight_end": 47,
533 "highlight_start": 1,
534 "text": " & * left_val, & * right_val)"
535 },
536 {
537 "highlight_end": 15,
538 "highlight_start": 1,
539 "text": " }"
540 },
541 {
542 "highlight_end": 11,
543 "highlight_start": 1,
544 "text": " }"
545 },
546 {
547 "highlight_end": 7,
548 "highlight_start": 1,
549 "text": " }"
550 },
551 {
552 "highlight_end": 42,
553 "highlight_start": 1,
554 "text": " }) ; ($ left : expr, $ right : expr,) =>"
555 },
556 {
557 "highlight_end": 49,
558 "highlight_start": 1,
559 "text": "({ $ crate :: assert_eq ! ($ left, $ right) }) ;"
560 },
561 {
562 "highlight_end": 53,
563 "highlight_start": 1,
564 "text": "($ left : expr, $ right : expr, $ ($ arg : tt) +) =>"
565 },
566 {
567 "highlight_end": 3,
568 "highlight_start": 1,
569 "text": "({"
570 },
571 {
572 "highlight_end": 37,
573 "highlight_start": 1,
574 "text": " match (& ($ left), & ($ right))"
575 },
576 {
577 "highlight_end": 7,
578 "highlight_start": 1,
579 "text": " {"
580 },
581 {
582 "highlight_end": 34,
583 "highlight_start": 1,
584 "text": " (left_val, right_val) =>"
585 },
586 {
587 "highlight_end": 11,
588 "highlight_start": 1,
589 "text": " {"
590 },
591 {
592 "highlight_end": 46,
593 "highlight_start": 1,
594 "text": " if ! (* left_val == * right_val)"
595 },
596 {
597 "highlight_end": 15,
598 "highlight_start": 1,
599 "text": " {"
600 },
601 {
602 "highlight_end": 25,
603 "highlight_start": 1,
604 "text": " panic !"
605 },
606 {
607 "highlight_end": 57,
608 "highlight_start": 1,
609 "text": " (r#\"assertion failed: `(left == right)`"
610 },
611 {
612 "highlight_end": 16,
613 "highlight_start": 1,
614 "text": " left: `{:?}`,"
615 },
616 {
617 "highlight_end": 22,
618 "highlight_start": 1,
619 "text": " right: `{:?}`: {}\"#,"
620 },
621 {
622 "highlight_end": 72,
623 "highlight_start": 1,
624 "text": " & * left_val, & * right_val, $ crate :: format_args !"
625 },
626 {
627 "highlight_end": 33,
628 "highlight_start": 1,
629 "text": " ($ ($ arg) +))"
630 },
631 {
632 "highlight_end": 15,
633 "highlight_start": 1,
634 "text": " }"
635 },
636 {
637 "highlight_end": 11,
638 "highlight_start": 1,
639 "text": " }"
640 },
641 {
642 "highlight_end": 7,
643 "highlight_start": 1,
644 "text": " }"
645 },
646 {
647 "highlight_end": 6,
648 "highlight_start": 1,
649 "text": " }) ;"
650 }
651 ]
652 },
653 "macro_decl_name": "assert_eq!",
654 "span": {
655 "byte_end": 38,
656 "byte_start": 16,
657 "column_end": 27,
658 "column_start": 5,
659 "expansion": null,
660 "file_name": "src/main.rs",
661 "is_primary": false,
662 "label": null,
663 "line_end": 2,
664 "line_start": 2,
665 "suggested_replacement": null,
666 "suggestion_applicability": null,
667 "text": [
668 {
669 "highlight_end": 27,
670 "highlight_start": 5,
671 "text": " assert_eq!(1, \"love\");"
672 }
673 ]
674 }
675 },
676 "file_name": "<::core::macros::assert_eq macros>",
677 "is_primary": true,
678 "label": "no implementation for `{integer} == &str`",
679 "line_end": 7,
680 "line_start": 7,
681 "suggested_replacement": null,
682 "suggestion_applicability": null,
683 "text": [
684 {
685 "highlight_end": 33,
686 "highlight_start": 31,
687 "text": " if ! (* left_val == * right_val)"
688 }
689 ]
690 }
691]
692}"##,
693 );
694
695 let workspace_root = PathBuf::from("/test/");
696 let diag = map_rust_diagnostic_to_lsp(&diag, &workspace_root).expect("couldn't map diagnostic");
697 insta::assert_debug_snapshot!(diag);
698}