aboutsummaryrefslogtreecommitdiff
path: root/crates/ra_lsp_server/src/main_loop/handlers.rs
diff options
context:
space:
mode:
authorbors[bot] <bors[bot]@users.noreply.github.com>2018-12-24 18:39:31 +0000
committerbors[bot] <bors[bot]@users.noreply.github.com>2018-12-24 18:39:31 +0000
commitb65ba8f1d62c2961e520885117056e405056959d (patch)
tree8b4b48b4e24c2b7fcf81ddc196586efd684a3c66 /crates/ra_lsp_server/src/main_loop/handlers.rs
parent67e768466ff2e2611eead0f30b2e9c4083c80c20 (diff)
parent0fb8894fbe3c2ea9f4be34065c3bd1b2a64f6356 (diff)
Merge #326
326: resolved #324: remove unnecessary braces in use statement. r=matklad a=gfreezy Add inspection for unnecessary braces in use statement Co-authored-by: gfreezy <[email protected]>
Diffstat (limited to 'crates/ra_lsp_server/src/main_loop/handlers.rs')
-rw-r--r--crates/ra_lsp_server/src/main_loop/handlers.rs15
1 files changed, 13 insertions, 2 deletions
diff --git a/crates/ra_lsp_server/src/main_loop/handlers.rs b/crates/ra_lsp_server/src/main_loop/handlers.rs
index 252d1ba3e..658d169cd 100644
--- a/crates/ra_lsp_server/src/main_loop/handlers.rs
+++ b/crates/ra_lsp_server/src/main_loop/handlers.rs
@@ -8,7 +8,7 @@ use languageserver_types::{
8 PrepareRenameResponse, RenameParams, SymbolInformation, TextDocumentIdentifier, TextEdit, 8 PrepareRenameResponse, RenameParams, SymbolInformation, TextDocumentIdentifier, TextEdit,
9 WorkspaceEdit, ParameterInformation, ParameterLabel, SignatureInformation, Hover, HoverContents, 9 WorkspaceEdit, ParameterInformation, ParameterLabel, SignatureInformation, Hover, HoverContents,
10}; 10};
11use ra_analysis::{FileId, FoldKind, Query, RunnableKind, FilePosition}; 11use ra_analysis::{FileId, FoldKind, Query, RunnableKind, FilePosition, Severity};
12use ra_syntax::{TextUnit, text_utils::intersect}; 12use ra_syntax::{TextUnit, text_utils::intersect};
13use ra_text_edit::text_utils::contains_offset_nonstrict; 13use ra_text_edit::text_utils::contains_offset_nonstrict;
14use rustc_hash::FxHashMap; 14use rustc_hash::FxHashMap;
@@ -650,7 +650,7 @@ pub fn publish_diagnostics(
650 .into_iter() 650 .into_iter()
651 .map(|d| Diagnostic { 651 .map(|d| Diagnostic {
652 range: d.range.conv_with(&line_index), 652 range: d.range.conv_with(&line_index),
653 severity: Some(DiagnosticSeverity::Error), 653 severity: Some(to_diagnostic_severity(d.severity)),
654 code: None, 654 code: None,
655 source: Some("rust-analyzer".to_string()), 655 source: Some("rust-analyzer".to_string()),
656 message: d.message, 656 message: d.message,
@@ -684,3 +684,14 @@ fn highlight(world: &ServerWorld, file_id: FileId) -> Result<Vec<Decoration>> {
684 .collect(); 684 .collect();
685 Ok(res) 685 Ok(res)
686} 686}
687
688fn to_diagnostic_severity(severity: Severity) -> DiagnosticSeverity {
689 use ra_analysis::Severity::*;
690
691 match severity {
692 Error => DiagnosticSeverity::Error,
693 Warning => DiagnosticSeverity::Warning,
694 Information => DiagnosticSeverity::Information,
695 Hint => DiagnosticSeverity::Hint,
696 }
697}