diff options
author | Aleksey Kladov <[email protected]> | 2020-08-18 15:03:15 +0100 |
---|---|---|
committer | Aleksey Kladov <[email protected]> | 2020-08-18 15:03:15 +0100 |
commit | 0866b1be894b9148cf69897a1e1aa70e3c416e29 (patch) | |
tree | 624481da5db0f0e57838767d3cff6892a7aa85cf /crates/rust-analyzer/src/diagnostics | |
parent | b8dfc331abbfce6aad0c248c91c57bd9890a668f (diff) |
Align diagnostics config with the rest of rust-analyzer
Diffstat (limited to 'crates/rust-analyzer/src/diagnostics')
-rw-r--r-- | crates/rust-analyzer/src/diagnostics/to_proto.rs | 18 |
1 files changed, 9 insertions, 9 deletions
diff --git a/crates/rust-analyzer/src/diagnostics/to_proto.rs b/crates/rust-analyzer/src/diagnostics/to_proto.rs index 6d5408156..df5583897 100644 --- a/crates/rust-analyzer/src/diagnostics/to_proto.rs +++ b/crates/rust-analyzer/src/diagnostics/to_proto.rs | |||
@@ -7,11 +7,11 @@ use stdx::format_to; | |||
7 | 7 | ||
8 | use crate::{lsp_ext, to_proto::url_from_abs_path}; | 8 | use crate::{lsp_ext, to_proto::url_from_abs_path}; |
9 | 9 | ||
10 | use super::DiagnosticsConfig; | 10 | use super::DiagnosticsMapConfig; |
11 | 11 | ||
12 | /// Determines the LSP severity from a diagnostic | 12 | /// Determines the LSP severity from a diagnostic |
13 | fn diagnostic_severity( | 13 | fn diagnostic_severity( |
14 | config: &DiagnosticsConfig, | 14 | config: &DiagnosticsMapConfig, |
15 | level: flycheck::DiagnosticLevel, | 15 | level: flycheck::DiagnosticLevel, |
16 | code: Option<flycheck::DiagnosticCode>, | 16 | code: Option<flycheck::DiagnosticCode>, |
17 | ) -> Option<lsp_types::DiagnosticSeverity> { | 17 | ) -> Option<lsp_types::DiagnosticSeverity> { |
@@ -141,7 +141,7 @@ pub(crate) struct MappedRustDiagnostic { | |||
141 | /// | 141 | /// |
142 | /// If the diagnostic has no primary span this will return `None` | 142 | /// If the diagnostic has no primary span this will return `None` |
143 | pub(crate) fn map_rust_diagnostic_to_lsp( | 143 | pub(crate) fn map_rust_diagnostic_to_lsp( |
144 | config: &DiagnosticsConfig, | 144 | config: &DiagnosticsMapConfig, |
145 | rd: &flycheck::Diagnostic, | 145 | rd: &flycheck::Diagnostic, |
146 | workspace_root: &Path, | 146 | workspace_root: &Path, |
147 | ) -> Vec<MappedRustDiagnostic> { | 147 | ) -> Vec<MappedRustDiagnostic> { |
@@ -259,10 +259,10 @@ mod tests { | |||
259 | use expect::{expect_file, ExpectFile}; | 259 | use expect::{expect_file, ExpectFile}; |
260 | 260 | ||
261 | fn check(diagnostics_json: &str, expect: ExpectFile) { | 261 | fn check(diagnostics_json: &str, expect: ExpectFile) { |
262 | check_with_config(DiagnosticsConfig::default(), diagnostics_json, expect) | 262 | check_with_config(DiagnosticsMapConfig::default(), diagnostics_json, expect) |
263 | } | 263 | } |
264 | 264 | ||
265 | fn check_with_config(config: DiagnosticsConfig, diagnostics_json: &str, expect: ExpectFile) { | 265 | fn check_with_config(config: DiagnosticsMapConfig, diagnostics_json: &str, expect: ExpectFile) { |
266 | let diagnostic: flycheck::Diagnostic = serde_json::from_str(diagnostics_json).unwrap(); | 266 | let diagnostic: flycheck::Diagnostic = serde_json::from_str(diagnostics_json).unwrap(); |
267 | let workspace_root = Path::new("/test/"); | 267 | let workspace_root = Path::new("/test/"); |
268 | let actual = map_rust_diagnostic_to_lsp(&config, &diagnostic, workspace_root); | 268 | let actual = map_rust_diagnostic_to_lsp(&config, &diagnostic, workspace_root); |
@@ -402,9 +402,9 @@ mod tests { | |||
402 | #[cfg(not(windows))] | 402 | #[cfg(not(windows))] |
403 | fn rustc_unused_variable_as_info() { | 403 | fn rustc_unused_variable_as_info() { |
404 | check_with_config( | 404 | check_with_config( |
405 | DiagnosticsConfig { | 405 | DiagnosticsMapConfig { |
406 | warnings_as_info: vec!["unused_variables".to_string()], | 406 | warnings_as_info: vec!["unused_variables".to_string()], |
407 | ..DiagnosticsConfig::default() | 407 | ..DiagnosticsMapConfig::default() |
408 | }, | 408 | }, |
409 | r##"{ | 409 | r##"{ |
410 | "message": "unused variable: `foo`", | 410 | "message": "unused variable: `foo`", |
@@ -486,9 +486,9 @@ mod tests { | |||
486 | #[cfg(not(windows))] | 486 | #[cfg(not(windows))] |
487 | fn rustc_unused_variable_as_hint() { | 487 | fn rustc_unused_variable_as_hint() { |
488 | check_with_config( | 488 | check_with_config( |
489 | DiagnosticsConfig { | 489 | DiagnosticsMapConfig { |
490 | warnings_as_hint: vec!["unused_variables".to_string()], | 490 | warnings_as_hint: vec!["unused_variables".to_string()], |
491 | ..DiagnosticsConfig::default() | 491 | ..DiagnosticsMapConfig::default() |
492 | }, | 492 | }, |
493 | r##"{ | 493 | r##"{ |
494 | "message": "unused variable: `foo`", | 494 | "message": "unused variable: `foo`", |