diff options
Diffstat (limited to 'crates/hir_def/src/attr.rs')
-rw-r--r-- | crates/hir_def/src/attr.rs | 15 |
1 files changed, 7 insertions, 8 deletions
diff --git a/crates/hir_def/src/attr.rs b/crates/hir_def/src/attr.rs index 86ae2f0fa..6b79e7bad 100644 --- a/crates/hir_def/src/attr.rs +++ b/crates/hir_def/src/attr.rs | |||
@@ -279,14 +279,13 @@ impl Attrs { | |||
279 | } | 279 | } |
280 | 280 | ||
281 | pub fn docs(&self) -> Option<Documentation> { | 281 | pub fn docs(&self) -> Option<Documentation> { |
282 | let docs = self | 282 | let docs = self.by_key("doc").attrs().flat_map(|attr| match attr.input.as_ref()? { |
283 | .by_key("doc") | 283 | AttrInput::Literal(s) => Some(s), |
284 | .attrs() | 284 | AttrInput::TokenTree(_) => None, |
285 | .flat_map(|attr| match attr.input.as_ref()? { | 285 | }); |
286 | AttrInput::Literal(s) => Some(s), | 286 | // FIXME: Replace `Itertools::intersperse` with `Iterator::intersperse[_with]` until the |
287 | AttrInput::TokenTree(_) => None, | 287 | // libstd api gets stabilized (https://github.com/rust-lang/rust/issues/79524). |
288 | }) | 288 | let docs = Itertools::intersperse(docs, &SmolStr::new_inline("\n")) |
289 | .intersperse(&SmolStr::new_inline("\n")) | ||
290 | .map(|it| it.as_str()) | 289 | .map(|it| it.as_str()) |
291 | .collect::<String>(); | 290 | .collect::<String>(); |
292 | if docs.is_empty() { | 291 | if docs.is_empty() { |