aboutsummaryrefslogtreecommitdiff
path: root/crates/ra_hir
diff options
context:
space:
mode:
authorAleksey Kladov <[email protected]>2019-10-08 18:33:43 +0100
committerAleksey Kladov <[email protected]>2019-10-08 18:33:43 +0100
commit5144f3b22ff2c32800672ca0146bce4bc9c805a4 (patch)
tree434e21b6654c38e69c4f8bc00b5e65cfcbe53113 /crates/ra_hir
parent2f85a640a2698fbd31155172218a91d2e986fd47 (diff)
refactor
Diffstat (limited to 'crates/ra_hir')
-rw-r--r--crates/ra_hir/src/code_model/docs.rs20
1 files changed, 9 insertions, 11 deletions
diff --git a/crates/ra_hir/src/code_model/docs.rs b/crates/ra_hir/src/code_model/docs.rs
index 9675e397f..8533b4f5e 100644
--- a/crates/ra_hir/src/code_model/docs.rs
+++ b/crates/ra_hir/src/code_model/docs.rs
@@ -6,21 +6,19 @@ use ra_syntax::ast;
6 6
7use crate::{ 7use crate::{
8 db::{AstDatabase, DefDatabase, HirDatabase}, 8 db::{AstDatabase, DefDatabase, HirDatabase},
9 Const, Enum, EnumVariant, FieldSource, Function, HasSource, MacroDef, Module, Static, Struct, 9 Adt, Const, Enum, EnumVariant, FieldSource, Function, HasSource, MacroDef, Module, Static,
10 StructField, Trait, TypeAlias, Union, 10 Struct, StructField, Trait, TypeAlias, Union,
11}; 11};
12 12
13#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash)] 13#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash)]
14pub enum DocDef { 14pub enum DocDef {
15 Module(Module), 15 Module(Module),
16 StructField(StructField), 16 StructField(StructField),
17 Struct(Struct), 17 Adt(Adt),
18 Enum(Enum),
19 EnumVariant(EnumVariant), 18 EnumVariant(EnumVariant),
20 Static(Static), 19 Static(Static),
21 Const(Const), 20 Const(Const),
22 Function(Function), 21 Function(Function),
23 Union(Union),
24 Trait(Trait), 22 Trait(Trait),
25 TypeAlias(TypeAlias), 23 TypeAlias(TypeAlias),
26 MacroDef(MacroDef), 24 MacroDef(MacroDef),
@@ -29,13 +27,11 @@ pub enum DocDef {
29impl_froms!( 27impl_froms!(
30 DocDef: Module, 28 DocDef: Module,
31 StructField, 29 StructField,
32 Struct, 30 Adt(Struct, Enum, Union),
33 Enum,
34 EnumVariant, 31 EnumVariant,
35 Static, 32 Static,
36 Const, 33 Const,
37 Function, 34 Function,
38 Union,
39 Trait, 35 Trait,
40 TypeAlias, 36 TypeAlias,
41 MacroDef 37 MacroDef
@@ -79,13 +75,15 @@ pub(crate) fn documentation_query(
79 FieldSource::Named(named) => docs_from_ast(&named), 75 FieldSource::Named(named) => docs_from_ast(&named),
80 FieldSource::Pos(..) => None, 76 FieldSource::Pos(..) => None,
81 }, 77 },
82 DocDef::Struct(it) => docs_from_ast(&it.source(db).ast), 78 DocDef::Adt(it) => match it {
83 DocDef::Enum(it) => docs_from_ast(&it.source(db).ast), 79 Adt::Struct(it) => docs_from_ast(&it.source(db).ast),
80 Adt::Enum(it) => docs_from_ast(&it.source(db).ast),
81 Adt::Union(it) => docs_from_ast(&it.source(db).ast),
82 },
84 DocDef::EnumVariant(it) => docs_from_ast(&it.source(db).ast), 83 DocDef::EnumVariant(it) => docs_from_ast(&it.source(db).ast),
85 DocDef::Static(it) => docs_from_ast(&it.source(db).ast), 84 DocDef::Static(it) => docs_from_ast(&it.source(db).ast),
86 DocDef::Const(it) => docs_from_ast(&it.source(db).ast), 85 DocDef::Const(it) => docs_from_ast(&it.source(db).ast),
87 DocDef::Function(it) => docs_from_ast(&it.source(db).ast), 86 DocDef::Function(it) => docs_from_ast(&it.source(db).ast),
88 DocDef::Union(it) => docs_from_ast(&it.source(db).ast),
89 DocDef::Trait(it) => docs_from_ast(&it.source(db).ast), 87 DocDef::Trait(it) => docs_from_ast(&it.source(db).ast),
90 DocDef::TypeAlias(it) => docs_from_ast(&it.source(db).ast), 88 DocDef::TypeAlias(it) => docs_from_ast(&it.source(db).ast),
91 DocDef::MacroDef(it) => docs_from_ast(&it.source(db).ast), 89 DocDef::MacroDef(it) => docs_from_ast(&it.source(db).ast),