diff options
Diffstat (limited to 'crates')
-rw-r--r-- | crates/hir/src/code_model.rs | 11 | ||||
-rw-r--r-- | crates/hir/src/lib.rs | 2 | ||||
-rw-r--r-- | crates/ide/src/call_info.rs | 2 | ||||
-rw-r--r-- | crates/ide/src/completion/complete_trait_impl.rs | 2 | ||||
-rw-r--r-- | crates/ide/src/completion/presentation.rs | 2 |
5 files changed, 7 insertions, 12 deletions
diff --git a/crates/hir/src/code_model.rs b/crates/hir/src/code_model.rs index 94dd7f6f5..e553fc7dc 100644 --- a/crates/hir/src/code_model.rs +++ b/crates/hir/src/code_model.rs | |||
@@ -1771,6 +1771,7 @@ impl_from!( | |||
1771 | 1771 | ||
1772 | pub trait HasAttrs { | 1772 | pub trait HasAttrs { |
1773 | fn attrs(self, db: &dyn HirDatabase) -> Attrs; | 1773 | fn attrs(self, db: &dyn HirDatabase) -> Attrs; |
1774 | fn docs(self, db: &dyn HirDatabase) -> Option<Documentation>; | ||
1774 | } | 1775 | } |
1775 | 1776 | ||
1776 | impl<T: Into<AttrDef>> HasAttrs for T { | 1777 | impl<T: Into<AttrDef>> HasAttrs for T { |
@@ -1778,14 +1779,8 @@ impl<T: Into<AttrDef>> HasAttrs for T { | |||
1778 | let def: AttrDef = self.into(); | 1779 | let def: AttrDef = self.into(); |
1779 | db.attrs(def.into()) | 1780 | db.attrs(def.into()) |
1780 | } | 1781 | } |
1781 | } | 1782 | fn docs(self, db: &dyn HirDatabase) -> Option<Documentation> { |
1782 | 1783 | let def: AttrDef = self.into(); | |
1783 | pub trait Docs { | ||
1784 | fn docs(&self, db: &dyn HirDatabase) -> Option<Documentation>; | ||
1785 | } | ||
1786 | impl<T: Into<AttrDef> + Copy> Docs for T { | ||
1787 | fn docs(&self, db: &dyn HirDatabase) -> Option<Documentation> { | ||
1788 | let def: AttrDef = (*self).into(); | ||
1789 | db.documentation(def.into()) | 1784 | db.documentation(def.into()) |
1790 | } | 1785 | } |
1791 | } | 1786 | } |
diff --git a/crates/hir/src/lib.rs b/crates/hir/src/lib.rs index d1f4d7813..2326e3fbb 100644 --- a/crates/hir/src/lib.rs +++ b/crates/hir/src/lib.rs | |||
@@ -34,7 +34,7 @@ mod has_source; | |||
34 | pub use crate::{ | 34 | pub use crate::{ |
35 | code_model::{ | 35 | code_model::{ |
36 | Access, Adt, AsAssocItem, AssocItem, AssocItemContainer, AttrDef, Callable, CallableKind, | 36 | Access, Adt, AsAssocItem, AssocItem, AssocItemContainer, AttrDef, Callable, CallableKind, |
37 | Const, Crate, CrateDependency, DefWithBody, Docs, Enum, EnumVariant, Field, FieldSource, | 37 | Const, Crate, CrateDependency, DefWithBody, Enum, EnumVariant, Field, FieldSource, |
38 | Function, GenericDef, HasAttrs, HasVisibility, ImplDef, Local, MacroDef, Module, ModuleDef, | 38 | Function, GenericDef, HasAttrs, HasVisibility, ImplDef, Local, MacroDef, Module, ModuleDef, |
39 | ScopeDef, Static, Struct, Trait, Type, TypeAlias, TypeParam, Union, VariantDef, Visibility, | 39 | ScopeDef, Static, Struct, Trait, Type, TypeAlias, TypeParam, Union, VariantDef, Visibility, |
40 | }, | 40 | }, |
diff --git a/crates/ide/src/call_info.rs b/crates/ide/src/call_info.rs index 7e83a2381..7e99c6b72 100644 --- a/crates/ide/src/call_info.rs +++ b/crates/ide/src/call_info.rs | |||
@@ -1,6 +1,6 @@ | |||
1 | //! FIXME: write short doc here | 1 | //! FIXME: write short doc here |
2 | use either::Either; | 2 | use either::Either; |
3 | use hir::{Docs, HirDisplay, Semantics, Type}; | 3 | use hir::{HasAttrs, HirDisplay, Semantics, Type}; |
4 | use ide_db::RootDatabase; | 4 | use ide_db::RootDatabase; |
5 | use stdx::format_to; | 5 | use stdx::format_to; |
6 | use syntax::{ | 6 | use syntax::{ |
diff --git a/crates/ide/src/completion/complete_trait_impl.rs b/crates/ide/src/completion/complete_trait_impl.rs index 1a2b1e8a5..26f268bd1 100644 --- a/crates/ide/src/completion/complete_trait_impl.rs +++ b/crates/ide/src/completion/complete_trait_impl.rs | |||
@@ -32,7 +32,7 @@ | |||
32 | //! ``` | 32 | //! ``` |
33 | 33 | ||
34 | use assists::utils::get_missing_assoc_items; | 34 | use assists::utils::get_missing_assoc_items; |
35 | use hir::{self, Docs, HasSource}; | 35 | use hir::{self, HasAttrs, HasSource}; |
36 | use syntax::{ | 36 | use syntax::{ |
37 | ast::{self, edit, Impl}, | 37 | ast::{self, edit, Impl}, |
38 | AstNode, SyntaxKind, SyntaxNode, TextRange, T, | 38 | AstNode, SyntaxKind, SyntaxNode, TextRange, T, |
diff --git a/crates/ide/src/completion/presentation.rs b/crates/ide/src/completion/presentation.rs index 3371aed2d..24c507f9b 100644 --- a/crates/ide/src/completion/presentation.rs +++ b/crates/ide/src/completion/presentation.rs | |||
@@ -1,7 +1,7 @@ | |||
1 | //! This modules takes care of rendering various definitions as completion items. | 1 | //! This modules takes care of rendering various definitions as completion items. |
2 | //! It also handles scoring (sorting) completions. | 2 | //! It also handles scoring (sorting) completions. |
3 | 3 | ||
4 | use hir::{Docs, HasAttrs, HasSource, HirDisplay, ModPath, ScopeDef, StructKind, Type}; | 4 | use hir::{HasAttrs, HasSource, HirDisplay, ModPath, ScopeDef, StructKind, Type}; |
5 | use itertools::Itertools; | 5 | use itertools::Itertools; |
6 | use syntax::ast::NameOwner; | 6 | use syntax::ast::NameOwner; |
7 | use test_utils::mark; | 7 | use test_utils::mark; |