diff options
author | Aleksey Kladov <[email protected]> | 2020-08-28 13:47:14 +0100 |
---|---|---|
committer | Aleksey Kladov <[email protected]> | 2020-08-28 13:47:14 +0100 |
commit | c692b5d76d7a9c01643f1f4be3fa8c777a9b0adb (patch) | |
tree | 482f663be7ad64ee0d9dce46241006a990a69460 /crates/rust-analyzer/src/diagnostics | |
parent | c9c0050fff45ebee56e5be8ae0add849fddfc85a (diff) |
:arrow_up: expect-test
Diffstat (limited to 'crates/rust-analyzer/src/diagnostics')
11 files changed, 595 insertions, 10 deletions
diff --git a/crates/rust-analyzer/src/diagnostics/test_data/clippy_pass_by_ref.txt b/crates/rust-analyzer/src/diagnostics/test_data/clippy_pass_by_ref.txt new file mode 100644 index 000000000..d06517126 --- /dev/null +++ b/crates/rust-analyzer/src/diagnostics/test_data/clippy_pass_by_ref.txt | |||
@@ -0,0 +1,67 @@ | |||
1 | [ | ||
2 | MappedRustDiagnostic { | ||
3 | url: "file:///test/compiler/mir/tagset.rs", | ||
4 | diagnostic: Diagnostic { | ||
5 | range: Range { | ||
6 | start: Position { | ||
7 | line: 41, | ||
8 | character: 23, | ||
9 | }, | ||
10 | end: Position { | ||
11 | line: 41, | ||
12 | character: 28, | ||
13 | }, | ||
14 | }, | ||
15 | severity: Some( | ||
16 | Warning, | ||
17 | ), | ||
18 | code: Some( | ||
19 | String( | ||
20 | "trivially_copy_pass_by_ref", | ||
21 | ), | ||
22 | ), | ||
23 | source: Some( | ||
24 | "clippy", | ||
25 | ), | ||
26 | message: "this argument is passed by reference, but would be more efficient if passed by value\n#[warn(clippy::trivially_copy_pass_by_ref)] implied by #[warn(clippy::all)]\nfor further information visit https://rust-lang.github.io/rust-clippy/master/index.html#trivially_copy_pass_by_ref", | ||
27 | related_information: Some( | ||
28 | [ | ||
29 | DiagnosticRelatedInformation { | ||
30 | location: Location { | ||
31 | uri: "file:///test/compiler/lib.rs", | ||
32 | range: Range { | ||
33 | start: Position { | ||
34 | line: 0, | ||
35 | character: 8, | ||
36 | }, | ||
37 | end: Position { | ||
38 | line: 0, | ||
39 | character: 19, | ||
40 | }, | ||
41 | }, | ||
42 | }, | ||
43 | message: "lint level defined here", | ||
44 | }, | ||
45 | DiagnosticRelatedInformation { | ||
46 | location: Location { | ||
47 | uri: "file:///test/compiler/mir/tagset.rs", | ||
48 | range: Range { | ||
49 | start: Position { | ||
50 | line: 41, | ||
51 | character: 23, | ||
52 | }, | ||
53 | end: Position { | ||
54 | line: 41, | ||
55 | character: 28, | ||
56 | }, | ||
57 | }, | ||
58 | }, | ||
59 | message: "consider passing by value instead", | ||
60 | }, | ||
61 | ], | ||
62 | ), | ||
63 | tags: None, | ||
64 | }, | ||
65 | fixes: [], | ||
66 | }, | ||
67 | ] | ||
diff --git a/crates/rust-analyzer/src/diagnostics/test_data/handles_macro_location.txt b/crates/rust-analyzer/src/diagnostics/test_data/handles_macro_location.txt new file mode 100644 index 000000000..f5de2f07f --- /dev/null +++ b/crates/rust-analyzer/src/diagnostics/test_data/handles_macro_location.txt | |||
@@ -0,0 +1,32 @@ | |||
1 | [ | ||
2 | MappedRustDiagnostic { | ||
3 | url: "file:///test/src/main.rs", | ||
4 | diagnostic: Diagnostic { | ||
5 | range: Range { | ||
6 | start: Position { | ||
7 | line: 1, | ||
8 | character: 4, | ||
9 | }, | ||
10 | end: Position { | ||
11 | line: 1, | ||
12 | character: 26, | ||
13 | }, | ||
14 | }, | ||
15 | severity: Some( | ||
16 | Error, | ||
17 | ), | ||
18 | code: Some( | ||
19 | String( | ||
20 | "E0277", | ||
21 | ), | ||
22 | ), | ||
23 | source: Some( | ||
24 | "rustc", | ||
25 | ), | ||
26 | message: "can\'t compare `{integer}` with `&str`\nthe trait `std::cmp::PartialEq<&str>` is not implemented for `{integer}`", | ||
27 | related_information: None, | ||
28 | tags: None, | ||
29 | }, | ||
30 | fixes: [], | ||
31 | }, | ||
32 | ] | ||
diff --git a/crates/rust-analyzer/src/diagnostics/test_data/macro_compiler_error.txt b/crates/rust-analyzer/src/diagnostics/test_data/macro_compiler_error.txt new file mode 100644 index 000000000..89dae7d5a --- /dev/null +++ b/crates/rust-analyzer/src/diagnostics/test_data/macro_compiler_error.txt | |||
@@ -0,0 +1,47 @@ | |||
1 | [ | ||
2 | MappedRustDiagnostic { | ||
3 | url: "file:///test/crates/hir_def/src/data.rs", | ||
4 | diagnostic: Diagnostic { | ||
5 | range: Range { | ||
6 | start: Position { | ||
7 | line: 79, | ||
8 | character: 15, | ||
9 | }, | ||
10 | end: Position { | ||
11 | line: 79, | ||
12 | character: 41, | ||
13 | }, | ||
14 | }, | ||
15 | severity: Some( | ||
16 | Error, | ||
17 | ), | ||
18 | code: None, | ||
19 | source: Some( | ||
20 | "rustc", | ||
21 | ), | ||
22 | message: "Please register your known path in the path module", | ||
23 | related_information: Some( | ||
24 | [ | ||
25 | DiagnosticRelatedInformation { | ||
26 | location: Location { | ||
27 | uri: "file:///test/crates/hir_def/src/path.rs", | ||
28 | range: Range { | ||
29 | start: Position { | ||
30 | line: 264, | ||
31 | character: 8, | ||
32 | }, | ||
33 | end: Position { | ||
34 | line: 264, | ||
35 | character: 76, | ||
36 | }, | ||
37 | }, | ||
38 | }, | ||
39 | message: "Error originated from macro here", | ||
40 | }, | ||
41 | ], | ||
42 | ), | ||
43 | tags: None, | ||
44 | }, | ||
45 | fixes: [], | ||
46 | }, | ||
47 | ] | ||
diff --git a/crates/rust-analyzer/src/diagnostics/test_data/rustc_incompatible_type_for_trait.txt b/crates/rust-analyzer/src/diagnostics/test_data/rustc_incompatible_type_for_trait.txt new file mode 100644 index 000000000..fc54440be --- /dev/null +++ b/crates/rust-analyzer/src/diagnostics/test_data/rustc_incompatible_type_for_trait.txt | |||
@@ -0,0 +1,32 @@ | |||
1 | [ | ||
2 | MappedRustDiagnostic { | ||
3 | url: "file:///test/compiler/ty/list_iter.rs", | ||
4 | diagnostic: Diagnostic { | ||
5 | range: Range { | ||
6 | start: Position { | ||
7 | line: 51, | ||
8 | character: 4, | ||
9 | }, | ||
10 | end: Position { | ||
11 | line: 51, | ||
12 | character: 47, | ||
13 | }, | ||
14 | }, | ||
15 | severity: Some( | ||
16 | Error, | ||
17 | ), | ||
18 | code: Some( | ||
19 | String( | ||
20 | "E0053", | ||
21 | ), | ||
22 | ), | ||
23 | source: Some( | ||
24 | "rustc", | ||
25 | ), | ||
26 | message: "method `next` has an incompatible type for trait\nexpected 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>>`", | ||
27 | related_information: None, | ||
28 | tags: None, | ||
29 | }, | ||
30 | fixes: [], | ||
31 | }, | ||
32 | ] | ||
diff --git a/crates/rust-analyzer/src/diagnostics/test_data/rustc_mismatched_type.txt b/crates/rust-analyzer/src/diagnostics/test_data/rustc_mismatched_type.txt new file mode 100644 index 000000000..c269af218 --- /dev/null +++ b/crates/rust-analyzer/src/diagnostics/test_data/rustc_mismatched_type.txt | |||
@@ -0,0 +1,32 @@ | |||
1 | [ | ||
2 | MappedRustDiagnostic { | ||
3 | url: "file:///test/runtime/compiler_support.rs", | ||
4 | diagnostic: Diagnostic { | ||
5 | range: Range { | ||
6 | start: Position { | ||
7 | line: 47, | ||
8 | character: 64, | ||
9 | }, | ||
10 | end: Position { | ||
11 | line: 47, | ||
12 | character: 69, | ||
13 | }, | ||
14 | }, | ||
15 | severity: Some( | ||
16 | Error, | ||
17 | ), | ||
18 | code: Some( | ||
19 | String( | ||
20 | "E0308", | ||
21 | ), | ||
22 | ), | ||
23 | source: Some( | ||
24 | "rustc", | ||
25 | ), | ||
26 | message: "mismatched types\nexpected usize, found u32", | ||
27 | related_information: None, | ||
28 | tags: None, | ||
29 | }, | ||
30 | fixes: [], | ||
31 | }, | ||
32 | ] | ||
diff --git a/crates/rust-analyzer/src/diagnostics/test_data/rustc_unused_variable.txt b/crates/rust-analyzer/src/diagnostics/test_data/rustc_unused_variable.txt new file mode 100644 index 000000000..74d91bc77 --- /dev/null +++ b/crates/rust-analyzer/src/diagnostics/test_data/rustc_unused_variable.txt | |||
@@ -0,0 +1,74 @@ | |||
1 | [ | ||
2 | MappedRustDiagnostic { | ||
3 | url: "file:///test/driver/subcommand/repl.rs", | ||
4 | diagnostic: Diagnostic { | ||
5 | range: Range { | ||
6 | start: Position { | ||
7 | line: 290, | ||
8 | character: 8, | ||
9 | }, | ||
10 | end: Position { | ||
11 | line: 290, | ||
12 | character: 11, | ||
13 | }, | ||
14 | }, | ||
15 | severity: Some( | ||
16 | Warning, | ||
17 | ), | ||
18 | code: Some( | ||
19 | String( | ||
20 | "unused_variables", | ||
21 | ), | ||
22 | ), | ||
23 | source: Some( | ||
24 | "rustc", | ||
25 | ), | ||
26 | message: "unused variable: `foo`\n#[warn(unused_variables)] on by default", | ||
27 | related_information: None, | ||
28 | tags: Some( | ||
29 | [ | ||
30 | Unnecessary, | ||
31 | ], | ||
32 | ), | ||
33 | }, | ||
34 | fixes: [ | ||
35 | CodeAction { | ||
36 | title: "consider prefixing with an underscore", | ||
37 | id: None, | ||
38 | group: None, | ||
39 | kind: Some( | ||
40 | CodeActionKind( | ||
41 | "quickfix", | ||
42 | ), | ||
43 | ), | ||
44 | edit: Some( | ||
45 | SnippetWorkspaceEdit { | ||
46 | changes: Some( | ||
47 | { | ||
48 | "file:///test/driver/subcommand/repl.rs": [ | ||
49 | TextEdit { | ||
50 | range: Range { | ||
51 | start: Position { | ||
52 | line: 290, | ||
53 | character: 8, | ||
54 | }, | ||
55 | end: Position { | ||
56 | line: 290, | ||
57 | character: 11, | ||
58 | }, | ||
59 | }, | ||
60 | new_text: "_foo", | ||
61 | }, | ||
62 | ], | ||
63 | }, | ||
64 | ), | ||
65 | document_changes: None, | ||
66 | }, | ||
67 | ), | ||
68 | is_preferred: Some( | ||
69 | true, | ||
70 | ), | ||
71 | }, | ||
72 | ], | ||
73 | }, | ||
74 | ] | ||
diff --git a/crates/rust-analyzer/src/diagnostics/test_data/rustc_unused_variable_as_hint.txt b/crates/rust-analyzer/src/diagnostics/test_data/rustc_unused_variable_as_hint.txt new file mode 100644 index 000000000..8a420c949 --- /dev/null +++ b/crates/rust-analyzer/src/diagnostics/test_data/rustc_unused_variable_as_hint.txt | |||
@@ -0,0 +1,74 @@ | |||
1 | [ | ||
2 | MappedRustDiagnostic { | ||
3 | url: "file:///test/driver/subcommand/repl.rs", | ||
4 | diagnostic: Diagnostic { | ||
5 | range: Range { | ||
6 | start: Position { | ||
7 | line: 290, | ||
8 | character: 8, | ||
9 | }, | ||
10 | end: Position { | ||
11 | line: 290, | ||
12 | character: 11, | ||
13 | }, | ||
14 | }, | ||
15 | severity: Some( | ||
16 | Hint, | ||
17 | ), | ||
18 | code: Some( | ||
19 | String( | ||
20 | "unused_variables", | ||
21 | ), | ||
22 | ), | ||
23 | source: Some( | ||
24 | "rustc", | ||
25 | ), | ||
26 | message: "unused variable: `foo`\n#[warn(unused_variables)] on by default", | ||
27 | related_information: None, | ||
28 | tags: Some( | ||
29 | [ | ||
30 | Unnecessary, | ||
31 | ], | ||
32 | ), | ||
33 | }, | ||
34 | fixes: [ | ||
35 | CodeAction { | ||
36 | title: "consider prefixing with an underscore", | ||
37 | id: None, | ||
38 | group: None, | ||
39 | kind: Some( | ||
40 | CodeActionKind( | ||
41 | "quickfix", | ||
42 | ), | ||
43 | ), | ||
44 | edit: Some( | ||
45 | SnippetWorkspaceEdit { | ||
46 | changes: Some( | ||
47 | { | ||
48 | "file:///test/driver/subcommand/repl.rs": [ | ||
49 | TextEdit { | ||
50 | range: Range { | ||
51 | start: Position { | ||
52 | line: 290, | ||
53 | character: 8, | ||
54 | }, | ||
55 | end: Position { | ||
56 | line: 290, | ||
57 | character: 11, | ||
58 | }, | ||
59 | }, | ||
60 | new_text: "_foo", | ||
61 | }, | ||
62 | ], | ||
63 | }, | ||
64 | ), | ||
65 | document_changes: None, | ||
66 | }, | ||
67 | ), | ||
68 | is_preferred: Some( | ||
69 | true, | ||
70 | ), | ||
71 | }, | ||
72 | ], | ||
73 | }, | ||
74 | ] | ||
diff --git a/crates/rust-analyzer/src/diagnostics/test_data/rustc_unused_variable_as_info.txt b/crates/rust-analyzer/src/diagnostics/test_data/rustc_unused_variable_as_info.txt new file mode 100644 index 000000000..79910660b --- /dev/null +++ b/crates/rust-analyzer/src/diagnostics/test_data/rustc_unused_variable_as_info.txt | |||
@@ -0,0 +1,74 @@ | |||
1 | [ | ||
2 | MappedRustDiagnostic { | ||
3 | url: "file:///test/driver/subcommand/repl.rs", | ||
4 | diagnostic: Diagnostic { | ||
5 | range: Range { | ||
6 | start: Position { | ||
7 | line: 290, | ||
8 | character: 8, | ||
9 | }, | ||
10 | end: Position { | ||
11 | line: 290, | ||
12 | character: 11, | ||
13 | }, | ||
14 | }, | ||
15 | severity: Some( | ||
16 | Information, | ||
17 | ), | ||
18 | code: Some( | ||
19 | String( | ||
20 | "unused_variables", | ||
21 | ), | ||
22 | ), | ||
23 | source: Some( | ||
24 | "rustc", | ||
25 | ), | ||
26 | message: "unused variable: `foo`\n#[warn(unused_variables)] on by default", | ||
27 | related_information: None, | ||
28 | tags: Some( | ||
29 | [ | ||
30 | Unnecessary, | ||
31 | ], | ||
32 | ), | ||
33 | }, | ||
34 | fixes: [ | ||
35 | CodeAction { | ||
36 | title: "consider prefixing with an underscore", | ||
37 | id: None, | ||
38 | group: None, | ||
39 | kind: Some( | ||
40 | CodeActionKind( | ||
41 | "quickfix", | ||
42 | ), | ||
43 | ), | ||
44 | edit: Some( | ||
45 | SnippetWorkspaceEdit { | ||
46 | changes: Some( | ||
47 | { | ||
48 | "file:///test/driver/subcommand/repl.rs": [ | ||
49 | TextEdit { | ||
50 | range: Range { | ||
51 | start: Position { | ||
52 | line: 290, | ||
53 | character: 8, | ||
54 | }, | ||
55 | end: Position { | ||
56 | line: 290, | ||
57 | character: 11, | ||
58 | }, | ||
59 | }, | ||
60 | new_text: "_foo", | ||
61 | }, | ||
62 | ], | ||
63 | }, | ||
64 | ), | ||
65 | document_changes: None, | ||
66 | }, | ||
67 | ), | ||
68 | is_preferred: Some( | ||
69 | true, | ||
70 | ), | ||
71 | }, | ||
72 | ], | ||
73 | }, | ||
74 | ] | ||
diff --git a/crates/rust-analyzer/src/diagnostics/test_data/rustc_wrong_number_of_parameters.txt b/crates/rust-analyzer/src/diagnostics/test_data/rustc_wrong_number_of_parameters.txt new file mode 100644 index 000000000..efe37261d --- /dev/null +++ b/crates/rust-analyzer/src/diagnostics/test_data/rustc_wrong_number_of_parameters.txt | |||
@@ -0,0 +1,51 @@ | |||
1 | [ | ||
2 | MappedRustDiagnostic { | ||
3 | url: "file:///test/compiler/ty/select.rs", | ||
4 | diagnostic: Diagnostic { | ||
5 | range: Range { | ||
6 | start: Position { | ||
7 | line: 103, | ||
8 | character: 17, | ||
9 | }, | ||
10 | end: Position { | ||
11 | line: 103, | ||
12 | character: 29, | ||
13 | }, | ||
14 | }, | ||
15 | severity: Some( | ||
16 | Error, | ||
17 | ), | ||
18 | code: Some( | ||
19 | String( | ||
20 | "E0061", | ||
21 | ), | ||
22 | ), | ||
23 | source: Some( | ||
24 | "rustc", | ||
25 | ), | ||
26 | message: "this function takes 2 parameters but 3 parameters were supplied\nexpected 2 parameters", | ||
27 | related_information: Some( | ||
28 | [ | ||
29 | DiagnosticRelatedInformation { | ||
30 | location: Location { | ||
31 | uri: "file:///test/compiler/ty/select.rs", | ||
32 | range: Range { | ||
33 | start: Position { | ||
34 | line: 218, | ||
35 | character: 4, | ||
36 | }, | ||
37 | end: Position { | ||
38 | line: 230, | ||
39 | character: 5, | ||
40 | }, | ||
41 | }, | ||
42 | }, | ||
43 | message: "defined here", | ||
44 | }, | ||
45 | ], | ||
46 | ), | ||
47 | tags: None, | ||
48 | }, | ||
49 | fixes: [], | ||
50 | }, | ||
51 | ] | ||
diff --git a/crates/rust-analyzer/src/diagnostics/test_data/snap_multi_line_fix.txt b/crates/rust-analyzer/src/diagnostics/test_data/snap_multi_line_fix.txt new file mode 100644 index 000000000..4f811ab64 --- /dev/null +++ b/crates/rust-analyzer/src/diagnostics/test_data/snap_multi_line_fix.txt | |||
@@ -0,0 +1,102 @@ | |||
1 | [ | ||
2 | MappedRustDiagnostic { | ||
3 | url: "file:///test/src/main.rs", | ||
4 | diagnostic: Diagnostic { | ||
5 | range: Range { | ||
6 | start: Position { | ||
7 | line: 3, | ||
8 | character: 4, | ||
9 | }, | ||
10 | end: Position { | ||
11 | line: 3, | ||
12 | character: 5, | ||
13 | }, | ||
14 | }, | ||
15 | severity: Some( | ||
16 | Warning, | ||
17 | ), | ||
18 | code: Some( | ||
19 | String( | ||
20 | "let_and_return", | ||
21 | ), | ||
22 | ), | ||
23 | source: Some( | ||
24 | "clippy", | ||
25 | ), | ||
26 | message: "returning the result of a let binding from a block\n`#[warn(clippy::let_and_return)]` on by default\nfor further information visit https://rust-lang.github.io/rust-clippy/master/index.html#let_and_return", | ||
27 | related_information: Some( | ||
28 | [ | ||
29 | DiagnosticRelatedInformation { | ||
30 | location: Location { | ||
31 | uri: "file:///test/src/main.rs", | ||
32 | range: Range { | ||
33 | start: Position { | ||
34 | line: 2, | ||
35 | character: 4, | ||
36 | }, | ||
37 | end: Position { | ||
38 | line: 2, | ||
39 | character: 30, | ||
40 | }, | ||
41 | }, | ||
42 | }, | ||
43 | message: "unnecessary let binding", | ||
44 | }, | ||
45 | ], | ||
46 | ), | ||
47 | tags: None, | ||
48 | }, | ||
49 | fixes: [ | ||
50 | CodeAction { | ||
51 | title: "return the expression directly", | ||
52 | id: None, | ||
53 | group: None, | ||
54 | kind: Some( | ||
55 | CodeActionKind( | ||
56 | "quickfix", | ||
57 | ), | ||
58 | ), | ||
59 | edit: Some( | ||
60 | SnippetWorkspaceEdit { | ||
61 | changes: Some( | ||
62 | { | ||
63 | "file:///test/src/main.rs": [ | ||
64 | TextEdit { | ||
65 | range: Range { | ||
66 | start: Position { | ||
67 | line: 2, | ||
68 | character: 4, | ||
69 | }, | ||
70 | end: Position { | ||
71 | line: 2, | ||
72 | character: 30, | ||
73 | }, | ||
74 | }, | ||
75 | new_text: "", | ||
76 | }, | ||
77 | TextEdit { | ||
78 | range: Range { | ||
79 | start: Position { | ||
80 | line: 3, | ||
81 | character: 4, | ||
82 | }, | ||
83 | end: Position { | ||
84 | line: 3, | ||
85 | character: 5, | ||
86 | }, | ||
87 | }, | ||
88 | new_text: "(0..10).collect()", | ||
89 | }, | ||
90 | ], | ||
91 | }, | ||
92 | ), | ||
93 | document_changes: None, | ||
94 | }, | ||
95 | ), | ||
96 | is_preferred: Some( | ||
97 | true, | ||
98 | ), | ||
99 | }, | ||
100 | ], | ||
101 | }, | ||
102 | ] | ||
diff --git a/crates/rust-analyzer/src/diagnostics/to_proto.rs b/crates/rust-analyzer/src/diagnostics/to_proto.rs index e52b97913..f69a949f2 100644 --- a/crates/rust-analyzer/src/diagnostics/to_proto.rs +++ b/crates/rust-analyzer/src/diagnostics/to_proto.rs | |||
@@ -315,7 +315,7 @@ mod tests { | |||
315 | "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" | 315 | "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 | } | 316 | } |
317 | "##, | 317 | "##, |
318 | expect_file!["crates/rust-analyzer/test_data/rustc_incompatible_type_for_trait.txt"], | 318 | expect_file!["./test_data/rustc_incompatible_type_for_trait.txt"], |
319 | ); | 319 | ); |
320 | } | 320 | } |
321 | 321 | ||
@@ -394,7 +394,7 @@ mod tests { | |||
394 | ], | 394 | ], |
395 | "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" | 395 | "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 | }"##, | 396 | }"##, |
397 | expect_file!["crates/rust-analyzer/test_data/rustc_unused_variable.txt"], | 397 | expect_file!["./test_data/rustc_unused_variable.txt"], |
398 | ); | 398 | ); |
399 | } | 399 | } |
400 | 400 | ||
@@ -478,7 +478,7 @@ mod tests { | |||
478 | ], | 478 | ], |
479 | "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" | 479 | "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 | }"##, | 480 | }"##, |
481 | expect_file!["crates/rust-analyzer/test_data/rustc_unused_variable_as_info.txt"], | 481 | expect_file!["./test_data/rustc_unused_variable_as_info.txt"], |
482 | ); | 482 | ); |
483 | } | 483 | } |
484 | 484 | ||
@@ -562,7 +562,7 @@ mod tests { | |||
562 | ], | 562 | ], |
563 | "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" | 563 | "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 | }"##, | 564 | }"##, |
565 | expect_file!["crates/rust-analyzer/test_data/rustc_unused_variable_as_hint.txt"], | 565 | expect_file!["./test_data/rustc_unused_variable_as_hint.txt"], |
566 | ); | 566 | ); |
567 | } | 567 | } |
568 | 568 | ||
@@ -683,7 +683,7 @@ mod tests { | |||
683 | "children": [], | 683 | "children": [], |
684 | "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" | 684 | "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 | }"##, | 685 | }"##, |
686 | expect_file!["crates/rust-analyzer/test_data/rustc_wrong_number_of_parameters.txt"], | 686 | expect_file!["./test_data/rustc_wrong_number_of_parameters.txt"], |
687 | ); | 687 | ); |
688 | } | 688 | } |
689 | 689 | ||
@@ -800,7 +800,7 @@ mod tests { | |||
800 | ], | 800 | ], |
801 | "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" | 801 | "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 | }"##, | 802 | }"##, |
803 | expect_file!["crates/rust-analyzer/test_data/clippy_pass_by_ref.txt"], | 803 | expect_file!["./test_data/clippy_pass_by_ref.txt"], |
804 | ); | 804 | ); |
805 | } | 805 | } |
806 | 806 | ||
@@ -840,7 +840,7 @@ mod tests { | |||
840 | "children": [], | 840 | "children": [], |
841 | "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" | 841 | "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 | }"##, | 842 | }"##, |
843 | expect_file!["crates/rust-analyzer/test_data/rustc_mismatched_type.txt"], | 843 | expect_file!["./test_data/rustc_mismatched_type.txt"], |
844 | ); | 844 | ); |
845 | } | 845 | } |
846 | 846 | ||
@@ -1108,7 +1108,7 @@ mod tests { | |||
1108 | } | 1108 | } |
1109 | ] | 1109 | ] |
1110 | }"##, | 1110 | }"##, |
1111 | expect_file!["crates/rust-analyzer/test_data/handles_macro_location.txt"], | 1111 | expect_file!["./test_data/handles_macro_location.txt"], |
1112 | ); | 1112 | ); |
1113 | } | 1113 | } |
1114 | 1114 | ||
@@ -1334,7 +1334,7 @@ mod tests { | |||
1334 | ] | 1334 | ] |
1335 | } | 1335 | } |
1336 | "##, | 1336 | "##, |
1337 | expect_file!["crates/rust-analyzer/test_data/macro_compiler_error.txt"], | 1337 | expect_file!["./test_data/macro_compiler_error.txt"], |
1338 | ); | 1338 | ); |
1339 | } | 1339 | } |
1340 | 1340 | ||
@@ -1464,7 +1464,7 @@ mod tests { | |||
1464 | ] | 1464 | ] |
1465 | } | 1465 | } |
1466 | "##, | 1466 | "##, |
1467 | expect_file!["crates/rust-analyzer/test_data/snap_multi_line_fix.txt"], | 1467 | expect_file!["./test_data/snap_multi_line_fix.txt"], |
1468 | ); | 1468 | ); |
1469 | } | 1469 | } |
1470 | } | 1470 | } |