diff options
author | gfreezy <[email protected]> | 2018-12-24 14:48:46 +0000 |
---|---|---|
committer | gfreezy <[email protected]> | 2018-12-24 14:48:46 +0000 |
commit | 70df097c89ee45e4e0709c21b8aeee2e84e09fc4 (patch) | |
tree | 8b35cc49f92065231a7e79a7de1e03bae791bb17 | |
parent | 17b35a7f7dc5054f8d632cd4d3fc2fcb26879819 (diff) |
keep severity to Error & WeakWarning
-rw-r--r-- | crates/ra_analysis/src/imp.rs | 2 | ||||
-rw-r--r-- | crates/ra_editor/src/lib.rs | 16 |
2 files changed, 8 insertions, 10 deletions
diff --git a/crates/ra_analysis/src/imp.rs b/crates/ra_analysis/src/imp.rs index e054227a9..e8d6acc17 100644 --- a/crates/ra_analysis/src/imp.rs +++ b/crates/ra_analysis/src/imp.rs | |||
@@ -364,7 +364,7 @@ impl AnalysisImpl { | |||
364 | .map(|d| Diagnostic { | 364 | .map(|d| Diagnostic { |
365 | range: d.range, | 365 | range: d.range, |
366 | message: d.msg, | 366 | message: d.msg, |
367 | severity: d.severity, | 367 | severity: Some(d.severity), |
368 | fix: None, | 368 | fix: None, |
369 | }) | 369 | }) |
370 | .collect::<Vec<_>>(); | 370 | .collect::<Vec<_>>(); |
diff --git a/crates/ra_editor/src/lib.rs b/crates/ra_editor/src/lib.rs index 399bb8fe8..75e4a5f32 100644 --- a/crates/ra_editor/src/lib.rs +++ b/crates/ra_editor/src/lib.rs | |||
@@ -34,16 +34,14 @@ pub struct HighlightedRange { | |||
34 | #[derive(Debug, Copy, Clone)] | 34 | #[derive(Debug, Copy, Clone)] |
35 | pub enum Severity { | 35 | pub enum Severity { |
36 | Error, | 36 | Error, |
37 | Warning, | 37 | WeakWarning, |
38 | Information, | ||
39 | Hint, | ||
40 | } | 38 | } |
41 | 39 | ||
42 | #[derive(Debug)] | 40 | #[derive(Debug)] |
43 | pub struct Diagnostic { | 41 | pub struct Diagnostic { |
44 | pub range: TextRange, | 42 | pub range: TextRange, |
45 | pub msg: String, | 43 | pub msg: String, |
46 | pub severity: Option<Severity>, | 44 | pub severity: Severity, |
47 | } | 45 | } |
48 | 46 | ||
49 | #[derive(Debug)] | 47 | #[derive(Debug)] |
@@ -112,7 +110,7 @@ pub fn diagnostics(file: &SourceFileNode) -> Vec<Diagnostic> { | |||
112 | .map(|err| Diagnostic { | 110 | .map(|err| Diagnostic { |
113 | range: location_to_range(err.location()), | 111 | range: location_to_range(err.location()), |
114 | msg: format!("Syntax Error: {}", err), | 112 | msg: format!("Syntax Error: {}", err), |
115 | severity: Some(Severity::Error), | 113 | severity: Severity::Error, |
116 | }) | 114 | }) |
117 | .collect(); | 115 | .collect(); |
118 | 116 | ||
@@ -130,7 +128,7 @@ fn check_unnecessary_braces_in_use_statement(file: &SourceFileNode) -> Vec<Diagn | |||
130 | diagnostics.push(Diagnostic { | 128 | diagnostics.push(Diagnostic { |
131 | range: use_tree_list.syntax().range(), | 129 | range: use_tree_list.syntax().range(), |
132 | msg: format!("Unnecessary braces in use statement"), | 130 | msg: format!("Unnecessary braces in use statement"), |
133 | severity: Some(Severity::Warning), | 131 | severity: Severity::WeakWarning, |
134 | }) | 132 | }) |
135 | } | 133 | } |
136 | } | 134 | } |
@@ -252,9 +250,9 @@ fn main() {} | |||
252 | ); | 250 | ); |
253 | let diagnostics = check_unnecessary_braces_in_use_statement(&file); | 251 | let diagnostics = check_unnecessary_braces_in_use_statement(&file); |
254 | assert_eq_dbg( | 252 | assert_eq_dbg( |
255 | r#"[Diagnostic { range: [12; 15), msg: "Unnecessary braces in use statement", severity: Some(Warning) }, | 253 | r#"[Diagnostic { range: [12; 15), msg: "Unnecessary braces in use statement", severity: WeakWarning }, |
256 | Diagnostic { range: [24; 27), msg: "Unnecessary braces in use statement", severity: Some(Warning) }, | 254 | Diagnostic { range: [24; 27), msg: "Unnecessary braces in use statement", severity: WeakWarning }, |
257 | Diagnostic { range: [61; 64), msg: "Unnecessary braces in use statement", severity: Some(Warning) }]"#, | 255 | Diagnostic { range: [61; 64), msg: "Unnecessary braces in use statement", severity: WeakWarning }]"#, |
258 | &diagnostics, | 256 | &diagnostics, |
259 | ) | 257 | ) |
260 | } | 258 | } |