aboutsummaryrefslogtreecommitdiff
path: root/crates/ra_lsp_server/src
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
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')
-rw-r--r--crates/ra_lsp_server/src/main_loop.rs4
-rw-r--r--crates/ra_lsp_server/src/main_loop/handlers.rs15
2 files changed, 15 insertions, 4 deletions
diff --git a/crates/ra_lsp_server/src/main_loop.rs b/crates/ra_lsp_server/src/main_loop.rs
index a5a2b5eec..60f13267c 100644
--- a/crates/ra_lsp_server/src/main_loop.rs
+++ b/crates/ra_lsp_server/src/main_loop.rs
@@ -13,7 +13,7 @@ use gen_lsp_server::{
13}; 13};
14use languageserver_types::NumberOrString; 14use languageserver_types::NumberOrString;
15use ra_analysis::{Canceled, FileId, LibraryData}; 15use ra_analysis::{Canceled, FileId, LibraryData};
16use ra_vfs::{VfsTask}; 16use ra_vfs::VfsTask;
17use rayon; 17use rayon;
18use threadpool::ThreadPool; 18use threadpool::ThreadPool;
19use rustc_hash::FxHashSet; 19use rustc_hash::FxHashSet;
@@ -23,7 +23,7 @@ use failure_derive::Fail;
23 23
24use crate::{ 24use crate::{
25 main_loop::subscriptions::Subscriptions, 25 main_loop::subscriptions::Subscriptions,
26 project_model::{workspace_loader}, 26 project_model::workspace_loader,
27 req, 27 req,
28 server_world::{ServerWorld, ServerWorldState}, 28 server_world::{ServerWorld, ServerWorldState},
29 Result, 29 Result,
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}