Simplify
This commit is contained in:
@@ -4,19 +4,7 @@ expression: diag
|
|||||||
---
|
---
|
||||||
[
|
[
|
||||||
MappedRustDiagnostic {
|
MappedRustDiagnostic {
|
||||||
location: Location {
|
url: "file:///test/compiler/mir/tagset.rs",
|
||||||
uri: "file:///test/compiler/mir/tagset.rs",
|
|
||||||
range: Range {
|
|
||||||
start: Position {
|
|
||||||
line: 41,
|
|
||||||
character: 23,
|
|
||||||
},
|
|
||||||
end: Position {
|
|
||||||
line: 41,
|
|
||||||
character: 28,
|
|
||||||
},
|
|
||||||
},
|
|
||||||
},
|
|
||||||
diagnostic: Diagnostic {
|
diagnostic: Diagnostic {
|
||||||
range: Range {
|
range: Range {
|
||||||
start: Position {
|
start: Position {
|
||||||
|
|||||||
@@ -4,19 +4,7 @@ expression: diag
|
|||||||
---
|
---
|
||||||
[
|
[
|
||||||
MappedRustDiagnostic {
|
MappedRustDiagnostic {
|
||||||
location: Location {
|
url: "file:///test/src/main.rs",
|
||||||
uri: "file:///test/src/main.rs",
|
|
||||||
range: Range {
|
|
||||||
start: Position {
|
|
||||||
line: 1,
|
|
||||||
character: 4,
|
|
||||||
},
|
|
||||||
end: Position {
|
|
||||||
line: 1,
|
|
||||||
character: 26,
|
|
||||||
},
|
|
||||||
},
|
|
||||||
},
|
|
||||||
diagnostic: Diagnostic {
|
diagnostic: Diagnostic {
|
||||||
range: Range {
|
range: Range {
|
||||||
start: Position {
|
start: Position {
|
||||||
|
|||||||
@@ -4,19 +4,7 @@ expression: diag
|
|||||||
---
|
---
|
||||||
[
|
[
|
||||||
MappedRustDiagnostic {
|
MappedRustDiagnostic {
|
||||||
location: Location {
|
url: "file:///test/crates/ra_hir_def/src/data.rs",
|
||||||
uri: "file:///test/crates/ra_hir_def/src/data.rs",
|
|
||||||
range: Range {
|
|
||||||
start: Position {
|
|
||||||
line: 79,
|
|
||||||
character: 15,
|
|
||||||
},
|
|
||||||
end: Position {
|
|
||||||
line: 79,
|
|
||||||
character: 41,
|
|
||||||
},
|
|
||||||
},
|
|
||||||
},
|
|
||||||
diagnostic: Diagnostic {
|
diagnostic: Diagnostic {
|
||||||
range: Range {
|
range: Range {
|
||||||
start: Position {
|
start: Position {
|
||||||
|
|||||||
@@ -4,19 +4,7 @@ expression: diag
|
|||||||
---
|
---
|
||||||
[
|
[
|
||||||
MappedRustDiagnostic {
|
MappedRustDiagnostic {
|
||||||
location: Location {
|
url: "file:///test/src/main.rs",
|
||||||
uri: "file:///test/src/main.rs",
|
|
||||||
range: Range {
|
|
||||||
start: Position {
|
|
||||||
line: 3,
|
|
||||||
character: 4,
|
|
||||||
},
|
|
||||||
end: Position {
|
|
||||||
line: 3,
|
|
||||||
character: 5,
|
|
||||||
},
|
|
||||||
},
|
|
||||||
},
|
|
||||||
diagnostic: Diagnostic {
|
diagnostic: Diagnostic {
|
||||||
range: Range {
|
range: Range {
|
||||||
start: Position {
|
start: Position {
|
||||||
|
|||||||
@@ -4,19 +4,7 @@ expression: diag
|
|||||||
---
|
---
|
||||||
[
|
[
|
||||||
MappedRustDiagnostic {
|
MappedRustDiagnostic {
|
||||||
location: Location {
|
url: "file:///test/compiler/ty/list_iter.rs",
|
||||||
uri: "file:///test/compiler/ty/list_iter.rs",
|
|
||||||
range: Range {
|
|
||||||
start: Position {
|
|
||||||
line: 51,
|
|
||||||
character: 4,
|
|
||||||
},
|
|
||||||
end: Position {
|
|
||||||
line: 51,
|
|
||||||
character: 47,
|
|
||||||
},
|
|
||||||
},
|
|
||||||
},
|
|
||||||
diagnostic: Diagnostic {
|
diagnostic: Diagnostic {
|
||||||
range: Range {
|
range: Range {
|
||||||
start: Position {
|
start: Position {
|
||||||
|
|||||||
@@ -4,19 +4,7 @@ expression: diag
|
|||||||
---
|
---
|
||||||
[
|
[
|
||||||
MappedRustDiagnostic {
|
MappedRustDiagnostic {
|
||||||
location: Location {
|
url: "file:///test/runtime/compiler_support.rs",
|
||||||
uri: "file:///test/runtime/compiler_support.rs",
|
|
||||||
range: Range {
|
|
||||||
start: Position {
|
|
||||||
line: 47,
|
|
||||||
character: 64,
|
|
||||||
},
|
|
||||||
end: Position {
|
|
||||||
line: 47,
|
|
||||||
character: 69,
|
|
||||||
},
|
|
||||||
},
|
|
||||||
},
|
|
||||||
diagnostic: Diagnostic {
|
diagnostic: Diagnostic {
|
||||||
range: Range {
|
range: Range {
|
||||||
start: Position {
|
start: Position {
|
||||||
|
|||||||
@@ -4,19 +4,7 @@ expression: diag
|
|||||||
---
|
---
|
||||||
[
|
[
|
||||||
MappedRustDiagnostic {
|
MappedRustDiagnostic {
|
||||||
location: Location {
|
url: "file:///test/driver/subcommand/repl.rs",
|
||||||
uri: "file:///test/driver/subcommand/repl.rs",
|
|
||||||
range: Range {
|
|
||||||
start: Position {
|
|
||||||
line: 290,
|
|
||||||
character: 8,
|
|
||||||
},
|
|
||||||
end: Position {
|
|
||||||
line: 290,
|
|
||||||
character: 11,
|
|
||||||
},
|
|
||||||
},
|
|
||||||
},
|
|
||||||
diagnostic: Diagnostic {
|
diagnostic: Diagnostic {
|
||||||
range: Range {
|
range: Range {
|
||||||
start: Position {
|
start: Position {
|
||||||
|
|||||||
@@ -4,19 +4,7 @@ expression: diag
|
|||||||
---
|
---
|
||||||
[
|
[
|
||||||
MappedRustDiagnostic {
|
MappedRustDiagnostic {
|
||||||
location: Location {
|
url: "file:///test/driver/subcommand/repl.rs",
|
||||||
uri: "file:///test/driver/subcommand/repl.rs",
|
|
||||||
range: Range {
|
|
||||||
start: Position {
|
|
||||||
line: 290,
|
|
||||||
character: 8,
|
|
||||||
},
|
|
||||||
end: Position {
|
|
||||||
line: 290,
|
|
||||||
character: 11,
|
|
||||||
},
|
|
||||||
},
|
|
||||||
},
|
|
||||||
diagnostic: Diagnostic {
|
diagnostic: Diagnostic {
|
||||||
range: Range {
|
range: Range {
|
||||||
start: Position {
|
start: Position {
|
||||||
|
|||||||
@@ -4,19 +4,7 @@ expression: diag
|
|||||||
---
|
---
|
||||||
[
|
[
|
||||||
MappedRustDiagnostic {
|
MappedRustDiagnostic {
|
||||||
location: Location {
|
url: "file:///test/driver/subcommand/repl.rs",
|
||||||
uri: "file:///test/driver/subcommand/repl.rs",
|
|
||||||
range: Range {
|
|
||||||
start: Position {
|
|
||||||
line: 290,
|
|
||||||
character: 8,
|
|
||||||
},
|
|
||||||
end: Position {
|
|
||||||
line: 290,
|
|
||||||
character: 11,
|
|
||||||
},
|
|
||||||
},
|
|
||||||
},
|
|
||||||
diagnostic: Diagnostic {
|
diagnostic: Diagnostic {
|
||||||
range: Range {
|
range: Range {
|
||||||
start: Position {
|
start: Position {
|
||||||
|
|||||||
@@ -4,19 +4,7 @@ expression: diag
|
|||||||
---
|
---
|
||||||
[
|
[
|
||||||
MappedRustDiagnostic {
|
MappedRustDiagnostic {
|
||||||
location: Location {
|
url: "file:///test/compiler/ty/select.rs",
|
||||||
uri: "file:///test/compiler/ty/select.rs",
|
|
||||||
range: Range {
|
|
||||||
start: Position {
|
|
||||||
line: 103,
|
|
||||||
character: 17,
|
|
||||||
},
|
|
||||||
end: Position {
|
|
||||||
line: 103,
|
|
||||||
character: 29,
|
|
||||||
},
|
|
||||||
},
|
|
||||||
},
|
|
||||||
diagnostic: Diagnostic {
|
diagnostic: Diagnostic {
|
||||||
range: Range {
|
range: Range {
|
||||||
start: Position {
|
start: Position {
|
||||||
|
|||||||
@@ -125,7 +125,7 @@ fn map_rust_child_diagnostic(
|
|||||||
|
|
||||||
#[derive(Debug)]
|
#[derive(Debug)]
|
||||||
pub(crate) struct MappedRustDiagnostic {
|
pub(crate) struct MappedRustDiagnostic {
|
||||||
pub(crate) location: lsp_types::Location,
|
pub(crate) url: lsp_types::Url,
|
||||||
pub(crate) diagnostic: lsp_types::Diagnostic,
|
pub(crate) diagnostic: lsp_types::Diagnostic,
|
||||||
pub(crate) fixes: Vec<lsp_ext::CodeAction>,
|
pub(crate) fixes: Vec<lsp_ext::CodeAction>,
|
||||||
}
|
}
|
||||||
@@ -246,7 +246,7 @@ pub(crate) fn map_rust_diagnostic_to_lsp(
|
|||||||
tags: if tags.is_empty() { None } else { Some(tags.clone()) },
|
tags: if tags.is_empty() { None } else { Some(tags.clone()) },
|
||||||
};
|
};
|
||||||
|
|
||||||
MappedRustDiagnostic { location, diagnostic, fixes: fixes.clone() }
|
MappedRustDiagnostic { url: location.uri, diagnostic, fixes: fixes.clone() }
|
||||||
})
|
})
|
||||||
.collect()
|
.collect()
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -238,7 +238,7 @@ impl GlobalState {
|
|||||||
&workspace_root,
|
&workspace_root,
|
||||||
);
|
);
|
||||||
for diag in diagnostics {
|
for diag in diagnostics {
|
||||||
match url_to_file_id(&self.vfs.read().0, &diag.location.uri) {
|
match url_to_file_id(&self.vfs.read().0, &diag.url) {
|
||||||
Ok(file_id) => self.diagnostics.add_check_diagnostic(
|
Ok(file_id) => self.diagnostics.add_check_diagnostic(
|
||||||
file_id,
|
file_id,
|
||||||
diag.diagnostic,
|
diag.diagnostic,
|
||||||
|
|||||||
Reference in New Issue
Block a user