aboutsummaryrefslogtreecommitdiff
path: root/crates/ra_hir_def/src/docs.rs
diff options
context:
space:
mode:
Diffstat (limited to 'crates/ra_hir_def/src/docs.rs')
-rw-r--r--crates/ra_hir_def/src/docs.rs22
1 files changed, 13 insertions, 9 deletions
diff --git a/crates/ra_hir_def/src/docs.rs b/crates/ra_hir_def/src/docs.rs
index 34ed9b7a5..b29f142e3 100644
--- a/crates/ra_hir_def/src/docs.rs
+++ b/crates/ra_hir_def/src/docs.rs
@@ -5,10 +5,14 @@
5 5
6use std::sync::Arc; 6use std::sync::Arc;
7 7
8use hir_expand::either::Either; 8use either::Either;
9use ra_syntax::ast; 9use ra_syntax::ast;
10 10
11use crate::{db::DefDatabase, AdtId, AstItemDef, AttrDefId, HasChildSource, HasSource, Lookup}; 11use crate::{
12 db::DefDatabase,
13 src::{HasChildSource, HasSource},
14 AdtId, AttrDefId, Lookup,
15};
12 16
13/// Holds documentation 17/// Holds documentation
14#[derive(Debug, Clone, PartialEq, Eq)] 18#[derive(Debug, Clone, PartialEq, Eq)]
@@ -42,21 +46,21 @@ impl Documentation {
42 AttrDefId::StructFieldId(it) => { 46 AttrDefId::StructFieldId(it) => {
43 let src = it.parent.child_source(db); 47 let src = it.parent.child_source(db);
44 match &src.value[it.local_id] { 48 match &src.value[it.local_id] {
45 Either::A(_tuple) => None, 49 Either::Left(_tuple) => None,
46 Either::B(record) => docs_from_ast(record), 50 Either::Right(record) => docs_from_ast(record),
47 } 51 }
48 } 52 }
49 AttrDefId::AdtId(it) => match it { 53 AttrDefId::AdtId(it) => match it {
50 AdtId::StructId(it) => docs_from_ast(&it.source(db).value), 54 AdtId::StructId(it) => docs_from_ast(&it.lookup(db).source(db).value),
51 AdtId::EnumId(it) => docs_from_ast(&it.source(db).value), 55 AdtId::EnumId(it) => docs_from_ast(&it.lookup(db).source(db).value),
52 AdtId::UnionId(it) => docs_from_ast(&it.source(db).value), 56 AdtId::UnionId(it) => docs_from_ast(&it.lookup(db).source(db).value),
53 }, 57 },
54 AttrDefId::EnumVariantId(it) => { 58 AttrDefId::EnumVariantId(it) => {
55 let src = it.parent.child_source(db); 59 let src = it.parent.child_source(db);
56 docs_from_ast(&src.value[it.local_id]) 60 docs_from_ast(&src.value[it.local_id])
57 } 61 }
58 AttrDefId::TraitId(it) => docs_from_ast(&it.source(db).value), 62 AttrDefId::TraitId(it) => docs_from_ast(&it.lookup(db).source(db).value),
59 AttrDefId::MacroDefId(it) => docs_from_ast(&it.ast_id.to_node(db)), 63 AttrDefId::MacroDefId(it) => docs_from_ast(&it.ast_id?.to_node(db)),
60 AttrDefId::ConstId(it) => docs_from_ast(&it.lookup(db).source(db).value), 64 AttrDefId::ConstId(it) => docs_from_ast(&it.lookup(db).source(db).value),
61 AttrDefId::StaticId(it) => docs_from_ast(&it.lookup(db).source(db).value), 65 AttrDefId::StaticId(it) => docs_from_ast(&it.lookup(db).source(db).value),
62 AttrDefId::FunctionId(it) => docs_from_ast(&it.lookup(db).source(db).value), 66 AttrDefId::FunctionId(it) => docs_from_ast(&it.lookup(db).source(db).value),