remove option from Diagnostic

This commit is contained in:
gfreezy 2018-12-24 23:00:18 +08:00
parent 70df097c89
commit 29798c763c
4 changed files with 7 additions and 7 deletions

View file

@ -364,7 +364,7 @@ impl AnalysisImpl {
.map(|d| Diagnostic { .map(|d| Diagnostic {
range: d.range, range: d.range,
message: d.msg, message: d.msg,
severity: Some(d.severity), severity: d.severity,
fix: None, fix: None,
}) })
.collect::<Vec<_>>(); .collect::<Vec<_>>();
@ -386,7 +386,7 @@ impl AnalysisImpl {
Diagnostic { Diagnostic {
range: name_node.range(), range: name_node.range(),
message: "unresolved module".to_string(), message: "unresolved module".to_string(),
severity: Some(Severity::Error), severity: Severity::Error,
fix: Some(fix), fix: Some(fix),
} }
} }
@ -409,7 +409,7 @@ impl AnalysisImpl {
Diagnostic { Diagnostic {
range: name_node.range(), range: name_node.range(),
message: "can't declare module at this location".to_string(), message: "can't declare module at this location".to_string(),
severity: Some(Severity::Error), severity: Severity::Error,
fix: Some(fix), fix: Some(fix),
} }
} }

View file

@ -197,7 +197,7 @@ pub struct Diagnostic {
pub message: String, pub message: String,
pub range: TextRange, pub range: TextRange,
pub fix: Option<SourceChange>, pub fix: Option<SourceChange>,
pub severity: Option<Severity>, pub severity: Severity,
} }
#[derive(Debug)] #[derive(Debug)]

View file

@ -13,7 +13,7 @@ use gen_lsp_server::{
}; };
use languageserver_types::NumberOrString; use languageserver_types::NumberOrString;
use ra_analysis::{Canceled, FileId, LibraryData}; use ra_analysis::{Canceled, FileId, LibraryData};
use ra_vfs::{VfsTask}; use ra_vfs::VfsTask;
use rayon; use rayon;
use threadpool::ThreadPool; use threadpool::ThreadPool;
use rustc_hash::FxHashSet; use rustc_hash::FxHashSet;
@ -23,7 +23,7 @@ use failure_derive::Fail;
use crate::{ use crate::{
main_loop::subscriptions::Subscriptions, main_loop::subscriptions::Subscriptions,
project_model::{workspace_loader}, project_model::workspace_loader,
req, req,
server_world::{ServerWorld, ServerWorldState}, server_world::{ServerWorld, ServerWorldState},
Result, Result,

View file

@ -650,7 +650,7 @@ pub fn publish_diagnostics(
.into_iter() .into_iter()
.map(|d| Diagnostic { .map(|d| Diagnostic {
range: d.range.conv_with(&line_index), range: d.range.conv_with(&line_index),
severity: d.severity.map(to_diagnostic_severity), severity: Some(to_diagnostic_severity(d.severity)),
code: None, code: None,
source: Some("rust-analyzer".to_string()), source: Some("rust-analyzer".to_string()),
message: d.message, message: d.message,