Skip to content

Commit eefaee1

Browse files
Delete Sidebar struct in favor of FnOnce impl
1 parent f4a15ae commit eefaee1

File tree

1 file changed

+2
-8
lines changed

1 file changed

+2
-8
lines changed

src/librustdoc/html/render.rs

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -387,8 +387,6 @@ struct Item<'a> {
387387
item: &'a clean::Item,
388388
}
389389

390-
struct Sidebar<'a> { cx: &'a Context, item: &'a clean::Item, }
391-
392390
/// Struct representing one entry in the JS search index. These are all emitted
393391
/// by hand to a large JS file at the end of cache-creation.
394392
#[derive(Debug)]
@@ -1994,7 +1992,7 @@ impl Context {
19941992

19951993
if !self.render_redirect_pages {
19961994
layout::render(&self.shared.layout, &page,
1997-
Sidebar{ cx: self, item: it },
1995+
|buf: &mut _| print_sidebar(self, it, buf),
19981996
&Item{ cx: self, item: it },
19991997
&self.shared.themes)
20001998
} else {
@@ -4266,10 +4264,7 @@ fn item_foreign_type(w: &mut fmt::Formatter<'_>, cx: &Context, it: &clean::Item)
42664264
render_assoc_items(w, cx, it, it.def_id, AssocItemRender::All)
42674265
}
42684266

4269-
impl Print for Sidebar<'_> {
4270-
fn print(self, buffer: &mut Buffer) {
4271-
let cx = self.cx;
4272-
let it = self.item;
4267+
fn print_sidebar(cx: &Context, it: &clean::Item, buffer: &mut Buffer) {
42734268
let parentlen = cx.current.len() - if it.is_mod() {1} else {0};
42744269

42754270
if it.is_struct() || it.is_trait() || it.is_primitive() || it.is_union()
@@ -4360,7 +4355,6 @@ impl Print for Sidebar<'_> {
43604355
// Closes sidebar-elems div.
43614356
write!(buffer, "</div>");
43624357
}
4363-
}
43644358

43654359
fn get_next_url(used_links: &mut FxHashSet<String>, url: String) -> String {
43664360
if used_links.insert(url.clone()) {

0 commit comments

Comments
 (0)