aboutsummaryrefslogtreecommitdiff
path: root/crates/hir_def/src/attr.rs
diff options
context:
space:
mode:
authorbors[bot] <26634292+bors[bot]@users.noreply.github.com>2021-01-02 20:47:27 +0000
committerGitHub <[email protected]>2021-01-02 20:47:27 +0000
commit895d97cfa016ca46c648d250eccb8befa7863502 (patch)
treef4c040a10f69b66aecd672406d69544e30742a8c /crates/hir_def/src/attr.rs
parenta88d4f8c7216105e8bffed55fe85d9de796dc172 (diff)
parent3e9847f7474b0df893351e4e1fe57dcb6f6171bd (diff)
Merge #7135
7135: Fix warnings on nightly r=lnicola a=cynecx Co-authored-by: cynecx <[email protected]>
Diffstat (limited to 'crates/hir_def/src/attr.rs')
-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() {