From 29798c763cc121f7d610544deb940d70e4e33649 Mon Sep 17 00:00:00 2001 From: gfreezy Date: Mon, 24 Dec 2018 23:00:18 +0800 Subject: [PATCH] remove option from Diagnostic --- crates/ra_analysis/src/imp.rs | 6 +++--- crates/ra_analysis/src/lib.rs | 2 +- crates/ra_lsp_server/src/main_loop.rs | 4 ++-- crates/ra_lsp_server/src/main_loop/handlers.rs | 2 +- 4 files changed, 7 insertions(+), 7 deletions(-) diff --git a/crates/ra_analysis/src/imp.rs b/crates/ra_analysis/src/imp.rs index e8d6acc177e..00cdf7effbc 100644 --- a/crates/ra_analysis/src/imp.rs +++ b/crates/ra_analysis/src/imp.rs @@ -364,7 +364,7 @@ impl AnalysisImpl { .map(|d| Diagnostic { range: d.range, message: d.msg, - severity: Some(d.severity), + severity: d.severity, fix: None, }) .collect::>(); @@ -386,7 +386,7 @@ impl AnalysisImpl { Diagnostic { range: name_node.range(), message: "unresolved module".to_string(), - severity: Some(Severity::Error), + severity: Severity::Error, fix: Some(fix), } } @@ -409,7 +409,7 @@ impl AnalysisImpl { Diagnostic { range: name_node.range(), message: "can't declare module at this location".to_string(), - severity: Some(Severity::Error), + severity: Severity::Error, fix: Some(fix), } } diff --git a/crates/ra_analysis/src/lib.rs b/crates/ra_analysis/src/lib.rs index a213fd60fbc..fbb19ed6b54 100644 --- a/crates/ra_analysis/src/lib.rs +++ b/crates/ra_analysis/src/lib.rs @@ -197,7 +197,7 @@ pub struct Diagnostic { pub message: String, pub range: TextRange, pub fix: Option, - pub severity: Option, + pub severity: Severity, } #[derive(Debug)] diff --git a/crates/ra_lsp_server/src/main_loop.rs b/crates/ra_lsp_server/src/main_loop.rs index 565ec92af5f..c0c414db07e 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::{ }; use languageserver_types::NumberOrString; use ra_analysis::{Canceled, FileId, LibraryData}; -use ra_vfs::{VfsTask}; +use ra_vfs::VfsTask; use rayon; use threadpool::ThreadPool; use rustc_hash::FxHashSet; @@ -23,7 +23,7 @@ use failure_derive::Fail; use crate::{ main_loop::subscriptions::Subscriptions, - project_model::{workspace_loader}, + project_model::workspace_loader, req, server_world::{ServerWorld, ServerWorldState}, Result, diff --git a/crates/ra_lsp_server/src/main_loop/handlers.rs b/crates/ra_lsp_server/src/main_loop/handlers.rs index 8e859e8d429..658d169cdaf 100644 --- a/crates/ra_lsp_server/src/main_loop/handlers.rs +++ b/crates/ra_lsp_server/src/main_loop/handlers.rs @@ -650,7 +650,7 @@ pub fn publish_diagnostics( .into_iter() .map(|d| Diagnostic { range: d.range.conv_with(&line_index), - severity: d.severity.map(to_diagnostic_severity), + severity: Some(to_diagnostic_severity(d.severity)), code: None, source: Some("rust-analyzer".to_string()), message: d.message,