From da0b348ae9f629c5cbe4a836a90ed85e36ca18e5 Mon Sep 17 00:00:00 2001 From: Aleksey Kladov Date: Tue, 8 Jan 2019 11:28:42 +0300 Subject: migrate ra_hir to rowan 2.0 --- crates/ra_hir/src/code_model_impl/module.rs | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) (limited to 'crates/ra_hir/src/code_model_impl') diff --git a/crates/ra_hir/src/code_model_impl/module.rs b/crates/ra_hir/src/code_model_impl/module.rs index eb35779f1..0d22c9dbe 100644 --- a/crates/ra_hir/src/code_model_impl/module.rs +++ b/crates/ra_hir/src/code_model_impl/module.rs @@ -1,5 +1,5 @@ use ra_db::{Cancelable, SourceRootId, FileId}; -use ra_syntax::{ast, SyntaxNode, AstNode}; +use ra_syntax::{ast, SyntaxNode, AstNode, TreePtr}; use crate::{ Module, ModuleSource, Problem, @@ -43,12 +43,11 @@ impl Module { let loc = self.def_id.loc(db); let file_id = loc.source_item_id.file_id.as_original_file(); let syntax_node = db.file_item(loc.source_item_id); - let syntax_node = syntax_node.borrowed(); - let module_source = if let Some(source_file) = ast::SourceFile::cast(syntax_node) { - ModuleSource::SourceFile(source_file.owned()) + let module_source = if let Some(source_file) = ast::SourceFile::cast(&syntax_node) { + ModuleSource::SourceFile(source_file.to_owned()) } else { - let module = ast::Module::cast(syntax_node).unwrap(); - ModuleSource::Module(module.owned()) + let module = ast::Module::cast(&syntax_node).unwrap(); + ModuleSource::Module(module.to_owned()) }; Ok((file_id, module_source)) } @@ -56,7 +55,7 @@ impl Module { pub fn declaration_source_impl( &self, db: &impl HirDatabase, - ) -> Cancelable> { + ) -> Cancelable)>> { let loc = self.def_id.loc(db); let module_tree = db.module_tree(loc.source_root_id)?; let link = ctry!(loc.module_id.parent_link(&module_tree)); @@ -146,7 +145,10 @@ impl Module { } Ok(curr_per_ns) } - pub fn problems_impl(&self, db: &impl HirDatabase) -> Cancelable> { + pub fn problems_impl( + &self, + db: &impl HirDatabase, + ) -> Cancelable, Problem)>> { let loc = self.def_id.loc(db); let module_tree = db.module_tree(loc.source_root_id)?; Ok(loc.module_id.problems(&module_tree, db)) -- cgit v1.2.3