switch modules to new diagnostics

This commit is contained in:
Aleksey Kladov 2019-03-23 18:35:14 +03:00
parent fcca35969d
commit 3fb88e95aa
8 changed files with 156 additions and 135 deletions

View file

@ -1,8 +1,8 @@
use ra_db::FileId;
use ra_syntax::{ast, SyntaxNode, TreeArc, AstNode};
use ra_syntax::{ast, TreeArc, AstNode};
use crate::{
Module, ModuleSource, Problem, Name,
Module, ModuleSource, Name,
nameres::{CrateModuleId, ImportId},
HirDatabase, DefDatabase,
HirFileId, SourceItemId,
@ -108,19 +108,4 @@ impl Module {
let parent_id = def_map[self.module_id].parent?;
Some(self.with_module_id(parent_id))
}
pub(crate) fn problems_impl(
&self,
db: &impl HirDatabase,
) -> Vec<(TreeArc<SyntaxNode>, Problem)> {
let def_map = db.crate_def_map(self.krate);
let (my_file_id, _) = self.definition_source(db);
// FIXME: not entirely corret filterint by module
def_map
.problems()
.iter()
.filter(|(source_item_id, _problem)| my_file_id == source_item_id.file_id)
.map(|(source_item_id, problem)| (db.file_item(*source_item_id), problem.clone()))
.collect()
}
}