aboutsummaryrefslogtreecommitdiff
path: root/crates/ra_ide/src/diagnostics.rs
diff options
context:
space:
mode:
Diffstat (limited to 'crates/ra_ide/src/diagnostics.rs')
-rw-r--r--crates/ra_ide/src/diagnostics.rs6
1 files changed, 2 insertions, 4 deletions
diff --git a/crates/ra_ide/src/diagnostics.rs b/crates/ra_ide/src/diagnostics.rs
index 478368529..f403b3bcf 100644
--- a/crates/ra_ide/src/diagnostics.rs
+++ b/crates/ra_ide/src/diagnostics.rs
@@ -23,6 +23,7 @@ pub enum Severity {
23 23
24pub(crate) fn diagnostics(db: &RootDatabase, file_id: FileId) -> Vec<Diagnostic> { 24pub(crate) fn diagnostics(db: &RootDatabase, file_id: FileId) -> Vec<Diagnostic> {
25 let _p = profile("diagnostics"); 25 let _p = profile("diagnostics");
26 let mut sb = hir::SourceBinder::new(db);
26 let parse = db.parse(file_id); 27 let parse = db.parse(file_id);
27 let mut res = Vec::new(); 28 let mut res = Vec::new();
28 29
@@ -108,10 +109,7 @@ pub(crate) fn diagnostics(db: &RootDatabase, file_id: FileId) -> Vec<Diagnostic>
108 fix: Some(fix), 109 fix: Some(fix),
109 }) 110 })
110 }); 111 });
111 let source_file = db.parse(file_id).tree(); 112 if let Some(m) = sb.to_module_def(file_id) {
112 let src =
113 hir::InFile { file_id: file_id.into(), value: hir::ModuleSource::SourceFile(source_file) };
114 if let Some(m) = hir::Module::from_definition(db, src) {
115 m.diagnostics(db, &mut sink); 113 m.diagnostics(db, &mut sink);
116 }; 114 };
117 drop(sink); 115 drop(sink);