aboutsummaryrefslogtreecommitdiff
path: root/crates/ra_ide_api/src/diagnostics.rs
diff options
context:
space:
mode:
Diffstat (limited to 'crates/ra_ide_api/src/diagnostics.rs')
-rw-r--r--crates/ra_ide_api/src/diagnostics.rs12
1 files changed, 6 insertions, 6 deletions
diff --git a/crates/ra_ide_api/src/diagnostics.rs b/crates/ra_ide_api/src/diagnostics.rs
index a46289cba..3f5b9e0a0 100644
--- a/crates/ra_ide_api/src/diagnostics.rs
+++ b/crates/ra_ide_api/src/diagnostics.rs
@@ -27,14 +27,14 @@ pub(crate) fn diagnostics(db: &RootDatabase, file_id: FileId) -> Vec<Diagnostic>
27 let parse = db.parse(file_id); 27 let parse = db.parse(file_id);
28 let mut res = Vec::new(); 28 let mut res = Vec::new();
29 29
30 res.extend(parse.errors.iter().map(|err| Diagnostic { 30 res.extend(parse.errors().iter().map(|err| Diagnostic {
31 range: location_to_range(err.location()), 31 range: location_to_range(err.location()),
32 message: format!("Syntax Error: {}", err), 32 message: format!("Syntax Error: {}", err),
33 severity: Severity::Error, 33 severity: Severity::Error,
34 fix: None, 34 fix: None,
35 })); 35 }));
36 36
37 for node in parse.tree.syntax().descendants() { 37 for node in parse.tree().syntax().descendants() {
38 check_unnecessary_braces_in_use_statement(&mut res, file_id, node); 38 check_unnecessary_braces_in_use_statement(&mut res, file_id, node);
39 check_struct_shorthand_initialization(&mut res, file_id, node); 39 check_struct_shorthand_initialization(&mut res, file_id, node);
40 } 40 }
@@ -181,18 +181,18 @@ mod tests {
181 type DiagnosticChecker = fn(&mut Vec<Diagnostic>, FileId, &SyntaxNode) -> Option<()>; 181 type DiagnosticChecker = fn(&mut Vec<Diagnostic>, FileId, &SyntaxNode) -> Option<()>;
182 182
183 fn check_not_applicable(code: &str, func: DiagnosticChecker) { 183 fn check_not_applicable(code: &str, func: DiagnosticChecker) {
184 let file = SourceFile::parse(code).tree; 184 let parse = SourceFile::parse(code);
185 let mut diagnostics = Vec::new(); 185 let mut diagnostics = Vec::new();
186 for node in file.syntax().descendants() { 186 for node in parse.tree().syntax().descendants() {
187 func(&mut diagnostics, FileId(0), node); 187 func(&mut diagnostics, FileId(0), node);
188 } 188 }
189 assert!(diagnostics.is_empty()); 189 assert!(diagnostics.is_empty());
190 } 190 }
191 191
192 fn check_apply(before: &str, after: &str, func: DiagnosticChecker) { 192 fn check_apply(before: &str, after: &str, func: DiagnosticChecker) {
193 let file = SourceFile::parse(before).tree; 193 let parse = SourceFile::parse(before);
194 let mut diagnostics = Vec::new(); 194 let mut diagnostics = Vec::new();
195 for node in file.syntax().descendants() { 195 for node in parse.tree().syntax().descendants() {
196 func(&mut diagnostics, FileId(0), node); 196 func(&mut diagnostics, FileId(0), node);
197 } 197 }
198 let diagnostic = 198 let diagnostic =