]> git.lizzy.rs Git - rust.git/commitdiff
Sort "implementations on foreign types" section in the sidebar
authorGuillaume Gomez <guillaume1.gomez@gmail.com>
Wed, 6 May 2020 09:13:00 +0000 (11:13 +0200)
committerGuillaume Gomez <guillaume1.gomez@gmail.com>
Sat, 9 May 2020 11:50:24 +0000 (13:50 +0200)
src/librustdoc/html/render.rs

index 666e59b9a045eda2991f7f23980abd6f026b4c69..4ad9651d563000f3e276475dce08db020b4e63e2 100644 (file)
@@ -4344,20 +4344,19 @@ fn sidebar_trait(buf: &mut Buffer, it: &clean::Item, t: &clean::Trait) {
         let mut res = implementors
             .iter()
             .filter(|i| i.inner_impl().for_.def_id().map_or(false, |d| !c.paths.contains_key(&d)))
-            .filter_map(|i| match extract_for_impl_name(&i.impl_item) {
-                Some((ref name, ref id)) => {
-                    Some(format!("<a href=\"#{}\">{}</a>", id, Escape(name)))
-                }
-                _ => None,
-            })
-            .collect::<Vec<String>>();
+            .filter_map(|i| extract_for_impl_name(&i.impl_item))
+            .collect::<Vec<_>>();
+
         if !res.is_empty() {
             res.sort();
             sidebar.push_str(&format!(
                 "<a class=\"sidebar-title\" href=\"#foreign-impls\">\
                                        Implementations on Foreign Types</a><div \
                                        class=\"sidebar-links\">{}</div>",
-                res.join("")
+                res.into_iter()
+                    .map(|(name, id)| format!("<a href=\"#{}\">{}</a>", id, Escape(&name)))
+                    .collect::<Vec<_>>()
+                    .join("")
             ));
         }
     }