aboutsummaryrefslogtreecommitdiff
path: root/crates
diff options
context:
space:
mode:
Diffstat (limited to 'crates')
-rw-r--r--crates/hir_def/src/attr.rs15
1 files changed, 7 insertions, 8 deletions
diff --git a/crates/hir_def/src/attr.rs b/crates/hir_def/src/attr.rs
index 042e119b1..fcf638e0f 100644
--- a/crates/hir_def/src/attr.rs
+++ b/crates/hir_def/src/attr.rs
@@ -260,14 +260,13 @@ impl Attrs {
260 } 260 }
261 261
262 pub fn docs(&self) -> Option<Documentation> { 262 pub fn docs(&self) -> Option<Documentation> {
263 let docs = self 263 let docs = self.by_key("doc").attrs().flat_map(|attr| match attr.input.as_ref()? {
264 .by_key("doc") 264 AttrInput::Literal(s) => Some(s),
265 .attrs() 265 AttrInput::TokenTree(_) => None,
266 .flat_map(|attr| match attr.input.as_ref()? { 266 });
267 AttrInput::Literal(s) => Some(s), 267 // FIXME: Replace `Itertools::intersperse` with `Iterator::intersperse[_with]` until the
268 AttrInput::TokenTree(_) => None, 268 // libstd api gets stabilized (https://github.com/rust-lang/rust/issues/79524).
269 }) 269 let docs = Itertools::intersperse(docs, &SmolStr::new_inline("\n"))
270 .intersperse(&SmolStr::new_inline("\n"))
271 .map(|it| it.as_str()) 270 .map(|it| it.as_str())
272 .collect::<String>(); 271 .collect::<String>();
273 if docs.is_empty() { 272 if docs.is_empty() {