⬆️ expect-test
This commit is contained in:
@@ -0,0 +1,67 @@
|
||||
[
|
||||
MappedRustDiagnostic {
|
||||
url: "file:///test/compiler/mir/tagset.rs",
|
||||
diagnostic: Diagnostic {
|
||||
range: Range {
|
||||
start: Position {
|
||||
line: 41,
|
||||
character: 23,
|
||||
},
|
||||
end: Position {
|
||||
line: 41,
|
||||
character: 28,
|
||||
},
|
||||
},
|
||||
severity: Some(
|
||||
Warning,
|
||||
),
|
||||
code: Some(
|
||||
String(
|
||||
"trivially_copy_pass_by_ref",
|
||||
),
|
||||
),
|
||||
source: Some(
|
||||
"clippy",
|
||||
),
|
||||
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",
|
||||
related_information: Some(
|
||||
[
|
||||
DiagnosticRelatedInformation {
|
||||
location: Location {
|
||||
uri: "file:///test/compiler/lib.rs",
|
||||
range: Range {
|
||||
start: Position {
|
||||
line: 0,
|
||||
character: 8,
|
||||
},
|
||||
end: Position {
|
||||
line: 0,
|
||||
character: 19,
|
||||
},
|
||||
},
|
||||
},
|
||||
message: "lint level defined here",
|
||||
},
|
||||
DiagnosticRelatedInformation {
|
||||
location: Location {
|
||||
uri: "file:///test/compiler/mir/tagset.rs",
|
||||
range: Range {
|
||||
start: Position {
|
||||
line: 41,
|
||||
character: 23,
|
||||
},
|
||||
end: Position {
|
||||
line: 41,
|
||||
character: 28,
|
||||
},
|
||||
},
|
||||
},
|
||||
message: "consider passing by value instead",
|
||||
},
|
||||
],
|
||||
),
|
||||
tags: None,
|
||||
},
|
||||
fixes: [],
|
||||
},
|
||||
]
|
||||
@@ -0,0 +1,32 @@
|
||||
[
|
||||
MappedRustDiagnostic {
|
||||
url: "file:///test/src/main.rs",
|
||||
diagnostic: Diagnostic {
|
||||
range: Range {
|
||||
start: Position {
|
||||
line: 1,
|
||||
character: 4,
|
||||
},
|
||||
end: Position {
|
||||
line: 1,
|
||||
character: 26,
|
||||
},
|
||||
},
|
||||
severity: Some(
|
||||
Error,
|
||||
),
|
||||
code: Some(
|
||||
String(
|
||||
"E0277",
|
||||
),
|
||||
),
|
||||
source: Some(
|
||||
"rustc",
|
||||
),
|
||||
message: "can\'t compare `{integer}` with `&str`\nthe trait `std::cmp::PartialEq<&str>` is not implemented for `{integer}`",
|
||||
related_information: None,
|
||||
tags: None,
|
||||
},
|
||||
fixes: [],
|
||||
},
|
||||
]
|
||||
@@ -0,0 +1,47 @@
|
||||
[
|
||||
MappedRustDiagnostic {
|
||||
url: "file:///test/crates/hir_def/src/data.rs",
|
||||
diagnostic: Diagnostic {
|
||||
range: Range {
|
||||
start: Position {
|
||||
line: 79,
|
||||
character: 15,
|
||||
},
|
||||
end: Position {
|
||||
line: 79,
|
||||
character: 41,
|
||||
},
|
||||
},
|
||||
severity: Some(
|
||||
Error,
|
||||
),
|
||||
code: None,
|
||||
source: Some(
|
||||
"rustc",
|
||||
),
|
||||
message: "Please register your known path in the path module",
|
||||
related_information: Some(
|
||||
[
|
||||
DiagnosticRelatedInformation {
|
||||
location: Location {
|
||||
uri: "file:///test/crates/hir_def/src/path.rs",
|
||||
range: Range {
|
||||
start: Position {
|
||||
line: 264,
|
||||
character: 8,
|
||||
},
|
||||
end: Position {
|
||||
line: 264,
|
||||
character: 76,
|
||||
},
|
||||
},
|
||||
},
|
||||
message: "Error originated from macro here",
|
||||
},
|
||||
],
|
||||
),
|
||||
tags: None,
|
||||
},
|
||||
fixes: [],
|
||||
},
|
||||
]
|
||||
@@ -0,0 +1,32 @@
|
||||
[
|
||||
MappedRustDiagnostic {
|
||||
url: "file:///test/compiler/ty/list_iter.rs",
|
||||
diagnostic: Diagnostic {
|
||||
range: Range {
|
||||
start: Position {
|
||||
line: 51,
|
||||
character: 4,
|
||||
},
|
||||
end: Position {
|
||||
line: 51,
|
||||
character: 47,
|
||||
},
|
||||
},
|
||||
severity: Some(
|
||||
Error,
|
||||
),
|
||||
code: Some(
|
||||
String(
|
||||
"E0053",
|
||||
),
|
||||
),
|
||||
source: Some(
|
||||
"rustc",
|
||||
),
|
||||
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>>`",
|
||||
related_information: None,
|
||||
tags: None,
|
||||
},
|
||||
fixes: [],
|
||||
},
|
||||
]
|
||||
@@ -0,0 +1,32 @@
|
||||
[
|
||||
MappedRustDiagnostic {
|
||||
url: "file:///test/runtime/compiler_support.rs",
|
||||
diagnostic: Diagnostic {
|
||||
range: Range {
|
||||
start: Position {
|
||||
line: 47,
|
||||
character: 64,
|
||||
},
|
||||
end: Position {
|
||||
line: 47,
|
||||
character: 69,
|
||||
},
|
||||
},
|
||||
severity: Some(
|
||||
Error,
|
||||
),
|
||||
code: Some(
|
||||
String(
|
||||
"E0308",
|
||||
),
|
||||
),
|
||||
source: Some(
|
||||
"rustc",
|
||||
),
|
||||
message: "mismatched types\nexpected usize, found u32",
|
||||
related_information: None,
|
||||
tags: None,
|
||||
},
|
||||
fixes: [],
|
||||
},
|
||||
]
|
||||
@@ -0,0 +1,74 @@
|
||||
[
|
||||
MappedRustDiagnostic {
|
||||
url: "file:///test/driver/subcommand/repl.rs",
|
||||
diagnostic: Diagnostic {
|
||||
range: Range {
|
||||
start: Position {
|
||||
line: 290,
|
||||
character: 8,
|
||||
},
|
||||
end: Position {
|
||||
line: 290,
|
||||
character: 11,
|
||||
},
|
||||
},
|
||||
severity: Some(
|
||||
Warning,
|
||||
),
|
||||
code: Some(
|
||||
String(
|
||||
"unused_variables",
|
||||
),
|
||||
),
|
||||
source: Some(
|
||||
"rustc",
|
||||
),
|
||||
message: "unused variable: `foo`\n#[warn(unused_variables)] on by default",
|
||||
related_information: None,
|
||||
tags: Some(
|
||||
[
|
||||
Unnecessary,
|
||||
],
|
||||
),
|
||||
},
|
||||
fixes: [
|
||||
CodeAction {
|
||||
title: "consider prefixing with an underscore",
|
||||
id: None,
|
||||
group: None,
|
||||
kind: Some(
|
||||
CodeActionKind(
|
||||
"quickfix",
|
||||
),
|
||||
),
|
||||
edit: Some(
|
||||
SnippetWorkspaceEdit {
|
||||
changes: Some(
|
||||
{
|
||||
"file:///test/driver/subcommand/repl.rs": [
|
||||
TextEdit {
|
||||
range: Range {
|
||||
start: Position {
|
||||
line: 290,
|
||||
character: 8,
|
||||
},
|
||||
end: Position {
|
||||
line: 290,
|
||||
character: 11,
|
||||
},
|
||||
},
|
||||
new_text: "_foo",
|
||||
},
|
||||
],
|
||||
},
|
||||
),
|
||||
document_changes: None,
|
||||
},
|
||||
),
|
||||
is_preferred: Some(
|
||||
true,
|
||||
),
|
||||
},
|
||||
],
|
||||
},
|
||||
]
|
||||
@@ -0,0 +1,74 @@
|
||||
[
|
||||
MappedRustDiagnostic {
|
||||
url: "file:///test/driver/subcommand/repl.rs",
|
||||
diagnostic: Diagnostic {
|
||||
range: Range {
|
||||
start: Position {
|
||||
line: 290,
|
||||
character: 8,
|
||||
},
|
||||
end: Position {
|
||||
line: 290,
|
||||
character: 11,
|
||||
},
|
||||
},
|
||||
severity: Some(
|
||||
Hint,
|
||||
),
|
||||
code: Some(
|
||||
String(
|
||||
"unused_variables",
|
||||
),
|
||||
),
|
||||
source: Some(
|
||||
"rustc",
|
||||
),
|
||||
message: "unused variable: `foo`\n#[warn(unused_variables)] on by default",
|
||||
related_information: None,
|
||||
tags: Some(
|
||||
[
|
||||
Unnecessary,
|
||||
],
|
||||
),
|
||||
},
|
||||
fixes: [
|
||||
CodeAction {
|
||||
title: "consider prefixing with an underscore",
|
||||
id: None,
|
||||
group: None,
|
||||
kind: Some(
|
||||
CodeActionKind(
|
||||
"quickfix",
|
||||
),
|
||||
),
|
||||
edit: Some(
|
||||
SnippetWorkspaceEdit {
|
||||
changes: Some(
|
||||
{
|
||||
"file:///test/driver/subcommand/repl.rs": [
|
||||
TextEdit {
|
||||
range: Range {
|
||||
start: Position {
|
||||
line: 290,
|
||||
character: 8,
|
||||
},
|
||||
end: Position {
|
||||
line: 290,
|
||||
character: 11,
|
||||
},
|
||||
},
|
||||
new_text: "_foo",
|
||||
},
|
||||
],
|
||||
},
|
||||
),
|
||||
document_changes: None,
|
||||
},
|
||||
),
|
||||
is_preferred: Some(
|
||||
true,
|
||||
),
|
||||
},
|
||||
],
|
||||
},
|
||||
]
|
||||
@@ -0,0 +1,74 @@
|
||||
[
|
||||
MappedRustDiagnostic {
|
||||
url: "file:///test/driver/subcommand/repl.rs",
|
||||
diagnostic: Diagnostic {
|
||||
range: Range {
|
||||
start: Position {
|
||||
line: 290,
|
||||
character: 8,
|
||||
},
|
||||
end: Position {
|
||||
line: 290,
|
||||
character: 11,
|
||||
},
|
||||
},
|
||||
severity: Some(
|
||||
Information,
|
||||
),
|
||||
code: Some(
|
||||
String(
|
||||
"unused_variables",
|
||||
),
|
||||
),
|
||||
source: Some(
|
||||
"rustc",
|
||||
),
|
||||
message: "unused variable: `foo`\n#[warn(unused_variables)] on by default",
|
||||
related_information: None,
|
||||
tags: Some(
|
||||
[
|
||||
Unnecessary,
|
||||
],
|
||||
),
|
||||
},
|
||||
fixes: [
|
||||
CodeAction {
|
||||
title: "consider prefixing with an underscore",
|
||||
id: None,
|
||||
group: None,
|
||||
kind: Some(
|
||||
CodeActionKind(
|
||||
"quickfix",
|
||||
),
|
||||
),
|
||||
edit: Some(
|
||||
SnippetWorkspaceEdit {
|
||||
changes: Some(
|
||||
{
|
||||
"file:///test/driver/subcommand/repl.rs": [
|
||||
TextEdit {
|
||||
range: Range {
|
||||
start: Position {
|
||||
line: 290,
|
||||
character: 8,
|
||||
},
|
||||
end: Position {
|
||||
line: 290,
|
||||
character: 11,
|
||||
},
|
||||
},
|
||||
new_text: "_foo",
|
||||
},
|
||||
],
|
||||
},
|
||||
),
|
||||
document_changes: None,
|
||||
},
|
||||
),
|
||||
is_preferred: Some(
|
||||
true,
|
||||
),
|
||||
},
|
||||
],
|
||||
},
|
||||
]
|
||||
@@ -0,0 +1,51 @@
|
||||
[
|
||||
MappedRustDiagnostic {
|
||||
url: "file:///test/compiler/ty/select.rs",
|
||||
diagnostic: Diagnostic {
|
||||
range: Range {
|
||||
start: Position {
|
||||
line: 103,
|
||||
character: 17,
|
||||
},
|
||||
end: Position {
|
||||
line: 103,
|
||||
character: 29,
|
||||
},
|
||||
},
|
||||
severity: Some(
|
||||
Error,
|
||||
),
|
||||
code: Some(
|
||||
String(
|
||||
"E0061",
|
||||
),
|
||||
),
|
||||
source: Some(
|
||||
"rustc",
|
||||
),
|
||||
message: "this function takes 2 parameters but 3 parameters were supplied\nexpected 2 parameters",
|
||||
related_information: Some(
|
||||
[
|
||||
DiagnosticRelatedInformation {
|
||||
location: Location {
|
||||
uri: "file:///test/compiler/ty/select.rs",
|
||||
range: Range {
|
||||
start: Position {
|
||||
line: 218,
|
||||
character: 4,
|
||||
},
|
||||
end: Position {
|
||||
line: 230,
|
||||
character: 5,
|
||||
},
|
||||
},
|
||||
},
|
||||
message: "defined here",
|
||||
},
|
||||
],
|
||||
),
|
||||
tags: None,
|
||||
},
|
||||
fixes: [],
|
||||
},
|
||||
]
|
||||
@@ -0,0 +1,102 @@
|
||||
[
|
||||
MappedRustDiagnostic {
|
||||
url: "file:///test/src/main.rs",
|
||||
diagnostic: Diagnostic {
|
||||
range: Range {
|
||||
start: Position {
|
||||
line: 3,
|
||||
character: 4,
|
||||
},
|
||||
end: Position {
|
||||
line: 3,
|
||||
character: 5,
|
||||
},
|
||||
},
|
||||
severity: Some(
|
||||
Warning,
|
||||
),
|
||||
code: Some(
|
||||
String(
|
||||
"let_and_return",
|
||||
),
|
||||
),
|
||||
source: Some(
|
||||
"clippy",
|
||||
),
|
||||
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",
|
||||
related_information: Some(
|
||||
[
|
||||
DiagnosticRelatedInformation {
|
||||
location: Location {
|
||||
uri: "file:///test/src/main.rs",
|
||||
range: Range {
|
||||
start: Position {
|
||||
line: 2,
|
||||
character: 4,
|
||||
},
|
||||
end: Position {
|
||||
line: 2,
|
||||
character: 30,
|
||||
},
|
||||
},
|
||||
},
|
||||
message: "unnecessary let binding",
|
||||
},
|
||||
],
|
||||
),
|
||||
tags: None,
|
||||
},
|
||||
fixes: [
|
||||
CodeAction {
|
||||
title: "return the expression directly",
|
||||
id: None,
|
||||
group: None,
|
||||
kind: Some(
|
||||
CodeActionKind(
|
||||
"quickfix",
|
||||
),
|
||||
),
|
||||
edit: Some(
|
||||
SnippetWorkspaceEdit {
|
||||
changes: Some(
|
||||
{
|
||||
"file:///test/src/main.rs": [
|
||||
TextEdit {
|
||||
range: Range {
|
||||
start: Position {
|
||||
line: 2,
|
||||
character: 4,
|
||||
},
|
||||
end: Position {
|
||||
line: 2,
|
||||
character: 30,
|
||||
},
|
||||
},
|
||||
new_text: "",
|
||||
},
|
||||
TextEdit {
|
||||
range: Range {
|
||||
start: Position {
|
||||
line: 3,
|
||||
character: 4,
|
||||
},
|
||||
end: Position {
|
||||
line: 3,
|
||||
character: 5,
|
||||
},
|
||||
},
|
||||
new_text: "(0..10).collect()",
|
||||
},
|
||||
],
|
||||
},
|
||||
),
|
||||
document_changes: None,
|
||||
},
|
||||
),
|
||||
is_preferred: Some(
|
||||
true,
|
||||
),
|
||||
},
|
||||
],
|
||||
},
|
||||
]
|
||||
@@ -315,7 +315,7 @@ mod tests {
|
||||
"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"
|
||||
}
|
||||
"##,
|
||||
expect_file!["crates/rust-analyzer/test_data/rustc_incompatible_type_for_trait.txt"],
|
||||
expect_file!["./test_data/rustc_incompatible_type_for_trait.txt"],
|
||||
);
|
||||
}
|
||||
|
||||
@@ -394,7 +394,7 @@ mod tests {
|
||||
],
|
||||
"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"
|
||||
}"##,
|
||||
expect_file!["crates/rust-analyzer/test_data/rustc_unused_variable.txt"],
|
||||
expect_file!["./test_data/rustc_unused_variable.txt"],
|
||||
);
|
||||
}
|
||||
|
||||
@@ -478,7 +478,7 @@ mod tests {
|
||||
],
|
||||
"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"
|
||||
}"##,
|
||||
expect_file!["crates/rust-analyzer/test_data/rustc_unused_variable_as_info.txt"],
|
||||
expect_file!["./test_data/rustc_unused_variable_as_info.txt"],
|
||||
);
|
||||
}
|
||||
|
||||
@@ -562,7 +562,7 @@ mod tests {
|
||||
],
|
||||
"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"
|
||||
}"##,
|
||||
expect_file!["crates/rust-analyzer/test_data/rustc_unused_variable_as_hint.txt"],
|
||||
expect_file!["./test_data/rustc_unused_variable_as_hint.txt"],
|
||||
);
|
||||
}
|
||||
|
||||
@@ -683,7 +683,7 @@ mod tests {
|
||||
"children": [],
|
||||
"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"
|
||||
}"##,
|
||||
expect_file!["crates/rust-analyzer/test_data/rustc_wrong_number_of_parameters.txt"],
|
||||
expect_file!["./test_data/rustc_wrong_number_of_parameters.txt"],
|
||||
);
|
||||
}
|
||||
|
||||
@@ -800,7 +800,7 @@ mod tests {
|
||||
],
|
||||
"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"
|
||||
}"##,
|
||||
expect_file!["crates/rust-analyzer/test_data/clippy_pass_by_ref.txt"],
|
||||
expect_file!["./test_data/clippy_pass_by_ref.txt"],
|
||||
);
|
||||
}
|
||||
|
||||
@@ -840,7 +840,7 @@ mod tests {
|
||||
"children": [],
|
||||
"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"
|
||||
}"##,
|
||||
expect_file!["crates/rust-analyzer/test_data/rustc_mismatched_type.txt"],
|
||||
expect_file!["./test_data/rustc_mismatched_type.txt"],
|
||||
);
|
||||
}
|
||||
|
||||
@@ -1108,7 +1108,7 @@ mod tests {
|
||||
}
|
||||
]
|
||||
}"##,
|
||||
expect_file!["crates/rust-analyzer/test_data/handles_macro_location.txt"],
|
||||
expect_file!["./test_data/handles_macro_location.txt"],
|
||||
);
|
||||
}
|
||||
|
||||
@@ -1334,7 +1334,7 @@ mod tests {
|
||||
]
|
||||
}
|
||||
"##,
|
||||
expect_file!["crates/rust-analyzer/test_data/macro_compiler_error.txt"],
|
||||
expect_file!["./test_data/macro_compiler_error.txt"],
|
||||
);
|
||||
}
|
||||
|
||||
@@ -1464,7 +1464,7 @@ mod tests {
|
||||
]
|
||||
}
|
||||
"##,
|
||||
expect_file!["crates/rust-analyzer/test_data/snap_multi_line_fix.txt"],
|
||||
expect_file!["./test_data/snap_multi_line_fix.txt"],
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user