diff options
author | Aaron Loucks <[email protected]> | 2020-06-03 11:14:56 +0100 |
---|---|---|
committer | Aaron Loucks <[email protected]> | 2020-06-03 11:54:41 +0100 |
commit | 85c4edb0afbc7cc855c434e5e7ec69aa469e0c4b (patch) | |
tree | 56464d5e77119bafcff03711de24dba775d54beb /crates/ra_hir_def | |
parent | 5837acce532e0cd65a1c0cb8c03cc18a4c22f327 (diff) |
Consolidate documentation expansion and merging
Removes the duplicated `expand_doc_attrs` and `merge_doc_comments_and_attrs`
functions from `ra_ide` and exposes the same functionality via
`ra_hir::Documentation::from_ast`.
Diffstat (limited to 'crates/ra_hir_def')
-rw-r--r-- | crates/ra_hir_def/src/docs.rs | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/crates/ra_hir_def/src/docs.rs b/crates/ra_hir_def/src/docs.rs index ab43cd3d3..2630b3d89 100644 --- a/crates/ra_hir_def/src/docs.rs +++ b/crates/ra_hir_def/src/docs.rs | |||
@@ -29,6 +29,13 @@ impl Documentation { | |||
29 | Documentation(s.into()) | 29 | Documentation(s.into()) |
30 | } | 30 | } |
31 | 31 | ||
32 | pub fn from_ast<N>(node: &N) -> Option<Documentation> | ||
33 | where | ||
34 | N: ast::DocCommentsOwner + ast::AttrsOwner, | ||
35 | { | ||
36 | docs_from_ast(node) | ||
37 | } | ||
38 | |||
32 | pub fn as_str(&self) -> &str { | 39 | pub fn as_str(&self) -> &str { |
33 | &*self.0 | 40 | &*self.0 |
34 | } | 41 | } |