use Source for module, part 2
This commit is contained in:
@@ -210,11 +210,11 @@ impl Module {
|
||||
pub fn declaration_source(
|
||||
self,
|
||||
db: &(impl DefDatabase + AstDatabase),
|
||||
) -> Option<(HirFileId, TreeArc<ast::Module>)> {
|
||||
) -> Option<Source<TreeArc<ast::Module>>> {
|
||||
let def_map = db.crate_def_map(self.krate);
|
||||
let decl = def_map[self.module_id].declaration?;
|
||||
let ast = decl.to_node(db);
|
||||
Some((decl.file_id(), ast))
|
||||
Some((decl.file_id(), ast).into())
|
||||
}
|
||||
|
||||
/// Returns the syntax of the last path segment corresponding to this import
|
||||
|
||||
@@ -71,7 +71,7 @@ pub(crate) fn documentation_query(
|
||||
def: DocDef,
|
||||
) -> Option<Documentation> {
|
||||
match def {
|
||||
DocDef::Module(it) => docs_from_ast(&*it.declaration_source(db)?.1),
|
||||
DocDef::Module(it) => docs_from_ast(&*it.declaration_source(db)?.ast),
|
||||
DocDef::StructField(it) => match it.source(db).ast {
|
||||
FieldSource::Named(named) => docs_from_ast(&*named),
|
||||
FieldSource::Pos(..) => return None,
|
||||
|
||||
Reference in New Issue
Block a user