about summary refs log tree commit diff
diff options
context:
space:
mode:
authorMark Rousskov <mark.simulacrum@gmail.com>2019-08-31 11:32:47 -0400
committerMark Rousskov <mark.simulacrum@gmail.com>2019-09-07 19:31:58 -0400
commiteefaee1af4cc3df09d2588638c2bb250fe6a30e6 (patch)
tree7e85c72839dba5b7022dbc9c7d822a83a647715e
parentf4a15ae3b248bf91f10f6e5d031ca84dc1942e19 (diff)
downloadrust-eefaee1af4cc3df09d2588638c2bb250fe6a30e6.tar.gz
rust-eefaee1af4cc3df09d2588638c2bb250fe6a30e6.zip
Delete Sidebar struct in favor of FnOnce impl
-rw-r--r--src/librustdoc/html/render.rs10
1 files changed, 2 insertions, 8 deletions
diff --git a/src/librustdoc/html/render.rs b/src/librustdoc/html/render.rs
index fc7038f8bda..3dec5c2a20e 100644
--- a/src/librustdoc/html/render.rs
+++ b/src/librustdoc/html/render.rs
@@ -387,8 +387,6 @@ struct Item<'a> {
     item: &'a clean::Item,
 }
 
-struct Sidebar<'a> { cx: &'a Context, item: &'a clean::Item, }
-
 /// Struct representing one entry in the JS search index. These are all emitted
 /// by hand to a large JS file at the end of cache-creation.
 #[derive(Debug)]
@@ -1994,7 +1992,7 @@ impl Context {
 
         if !self.render_redirect_pages {
             layout::render(&self.shared.layout, &page,
-                           Sidebar{ cx: self, item: it },
+                           |buf: &mut _| print_sidebar(self, it, buf),
                            &Item{ cx: self, item: it },
                            &self.shared.themes)
         } else {
@@ -4266,10 +4264,7 @@ fn item_foreign_type(w: &mut fmt::Formatter<'_>, cx: &Context, it: &clean::Item)
     render_assoc_items(w, cx, it, it.def_id, AssocItemRender::All)
 }
 
-impl Print for Sidebar<'_> {
-    fn print(self, buffer: &mut Buffer) {
-        let cx = self.cx;
-        let it = self.item;
+    fn print_sidebar(cx: &Context, it: &clean::Item, buffer: &mut Buffer) {
         let parentlen = cx.current.len() - if it.is_mod() {1} else {0};
 
         if it.is_struct() || it.is_trait() || it.is_primitive() || it.is_union()
@@ -4360,7 +4355,6 @@ impl Print for Sidebar<'_> {
         // Closes sidebar-elems div.
         write!(buffer, "</div>");
     }
-}
 
 fn get_next_url(used_links: &mut FxHashSet<String>, url: String) -> String {
     if used_links.insert(url.clone()) {