aboutsummaryrefslogtreecommitdiff
path: root/crates/ra_hir
diff options
context:
space:
mode:
authorbors[bot] <26634292+bors[bot]@users.noreply.github.com>2019-10-09 09:16:18 +0100
committerGitHub <[email protected]>2019-10-09 09:16:18 +0100
commitd5a6cac3357f22dea2e630e17d0f091988cdd558 (patch)
tree416648fde13020d33d62068a5d52221c66c210b5 /crates/ra_hir
parent06a8deae4a29949f438d66c54eed4e016ac35432 (diff)
parente0b1c17dcb367a3edfd9df4b1d7cfbcd059cd207 (diff)
Merge #1970
1970: Add <> when completing generics r=matklad a=matklad @flodiebold wdyt? Is it correct that we always need to add `<>` in generic types? Co-authored-by: Aleksey Kladov <[email protected]>
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),