]> git.lizzy.rs Git - rust.git/commitdiff
Use fully qualified `Itertools::intersperse` call to silence nightly warnings about...
authorcynecx <me@cynecx.net>
Sat, 2 Jan 2021 19:58:06 +0000 (20:58 +0100)
committercynecx <me@cynecx.net>
Sat, 2 Jan 2021 19:58:53 +0000 (20:58 +0100)
crates/hir_def/src/attr.rs

index 042e119b12e35fd5f25757b016817e3b62c36f3e..fcf638e0fa99a83b7d651298680609c338b4a60f 100644 (file)
@@ -260,14 +260,13 @@ pub(crate) fn is_cfg_enabled(&self, cfg_options: &CfgOptions) -> bool {
     }
 
     pub fn docs(&self) -> Option<Documentation> {
-        let docs = self
-            .by_key("doc")
-            .attrs()
-            .flat_map(|attr| match attr.input.as_ref()? {
-                AttrInput::Literal(s) => Some(s),
-                AttrInput::TokenTree(_) => None,
-            })
-            .intersperse(&SmolStr::new_inline("\n"))
+        let docs = self.by_key("doc").attrs().flat_map(|attr| match attr.input.as_ref()? {
+            AttrInput::Literal(s) => Some(s),
+            AttrInput::TokenTree(_) => None,
+        });
+        // FIXME: Replace `Itertools::intersperse` with `Iterator::intersperse[_with]` until the
+        // libstd api gets stabilized (https://github.com/rust-lang/rust/issues/79524).
+        let docs = Itertools::intersperse(docs, &SmolStr::new_inline("\n"))
             .map(|it| it.as_str())
             .collect::<String>();
         if docs.is_empty() {