aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAleksey Kladov <[email protected]>2019-06-11 15:48:27 +0100
committerAleksey Kladov <[email protected]>2019-06-11 16:28:51 +0100
commitdd63f17027d5c873a5782dcbb08e9b068fc8ee00 (patch)
tree925ed48be65afe9d534332db57f486fa8cf60e73
parent0145d06515d990f8b7bf45e261674c265c52d858 (diff)
use Source for module, part 2
-rw-r--r--crates/ra_hir/src/code_model.rs4
-rw-r--r--crates/ra_hir/src/docs.rs2
-rw-r--r--crates/ra_ide_api/src/display/navigation_target.rs10
3 files changed, 8 insertions, 8 deletions
diff --git a/crates/ra_hir/src/code_model.rs b/crates/ra_hir/src/code_model.rs
index e920256e5..1a33127fa 100644
--- a/crates/ra_hir/src/code_model.rs
+++ b/crates/ra_hir/src/code_model.rs
@@ -210,11 +210,11 @@ impl Module {
210 pub fn declaration_source( 210 pub fn declaration_source(
211 self, 211 self,
212 db: &(impl DefDatabase + AstDatabase), 212 db: &(impl DefDatabase + AstDatabase),
213 ) -> Option<(HirFileId, TreeArc<ast::Module>)> { 213 ) -> Option<Source<TreeArc<ast::Module>>> {
214 let def_map = db.crate_def_map(self.krate); 214 let def_map = db.crate_def_map(self.krate);
215 let decl = def_map[self.module_id].declaration?; 215 let decl = def_map[self.module_id].declaration?;
216 let ast = decl.to_node(db); 216 let ast = decl.to_node(db);
217 Some((decl.file_id(), ast)) 217 Some((decl.file_id(), ast).into())
218 } 218 }
219 219
220 /// Returns the syntax of the last path segment corresponding to this import 220 /// Returns the syntax of the last path segment corresponding to this import
diff --git a/crates/ra_hir/src/docs.rs b/crates/ra_hir/src/docs.rs
index ae82d55a5..4db066c43 100644
--- a/crates/ra_hir/src/docs.rs
+++ b/crates/ra_hir/src/docs.rs
@@ -71,7 +71,7 @@ pub(crate) fn documentation_query(
71 def: DocDef, 71 def: DocDef,
72) -> Option<Documentation> { 72) -> Option<Documentation> {
73 match def { 73 match def {
74 DocDef::Module(it) => docs_from_ast(&*it.declaration_source(db)?.1), 74 DocDef::Module(it) => docs_from_ast(&*it.declaration_source(db)?.ast),
75 DocDef::StructField(it) => match it.source(db).ast { 75 DocDef::StructField(it) => match it.source(db).ast {
76 FieldSource::Named(named) => docs_from_ast(&*named), 76 FieldSource::Named(named) => docs_from_ast(&*named),
77 FieldSource::Pos(..) => return None, 77 FieldSource::Pos(..) => return None,
diff --git a/crates/ra_ide_api/src/display/navigation_target.rs b/crates/ra_ide_api/src/display/navigation_target.rs
index 4a92be710..d7687e1a4 100644
--- a/crates/ra_ide_api/src/display/navigation_target.rs
+++ b/crates/ra_ide_api/src/display/navigation_target.rs
@@ -149,15 +149,15 @@ impl NavigationTarget {
149 149
150 pub(crate) fn from_module_to_decl(db: &RootDatabase, module: hir::Module) -> NavigationTarget { 150 pub(crate) fn from_module_to_decl(db: &RootDatabase, module: hir::Module) -> NavigationTarget {
151 let name = module.name(db).map(|it| it.to_string().into()).unwrap_or_default(); 151 let name = module.name(db).map(|it| it.to_string().into()).unwrap_or_default();
152 if let Some((file_id, source)) = module.declaration_source(db) { 152 if let Some(src) = module.declaration_source(db) {
153 let file_id = file_id.as_original_file(); 153 let file_id = src.file_id.as_original_file();
154 return NavigationTarget::from_syntax( 154 return NavigationTarget::from_syntax(
155 file_id, 155 file_id,
156 name, 156 name,
157 None, 157 None,
158 source.syntax(), 158 src.ast.syntax(),
159 source.doc_comment_text(), 159 src.ast.doc_comment_text(),
160 source.short_label(), 160 src.ast.short_label(),
161 ); 161 );
162 } 162 }
163 NavigationTarget::from_module(db, module) 163 NavigationTarget::from_module(db, module)