aboutsummaryrefslogtreecommitdiff
path: root/crates/ra_editor/src/lib.rs
diff options
context:
space:
mode:
Diffstat (limited to 'crates/ra_editor/src/lib.rs')
-rw-r--r--crates/ra_editor/src/lib.rs16
1 files changed, 7 insertions, 9 deletions
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)]
35pub enum Severity { 35pub enum Severity {
36 Error, 36 Error,
37 Warning, 37 WeakWarning,
38 Information,
39 Hint,
40} 38}
41 39
42#[derive(Debug)] 40#[derive(Debug)]
43pub struct Diagnostic { 41pub 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 }