diff options
Diffstat (limited to 'crates/hir/src/code_model.rs')
-rw-r--r-- | crates/hir/src/code_model.rs | 11 |
1 files changed, 3 insertions, 8 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 | } |