@@ -27,9 +27,6 @@ crate trait FormatRenderer<'tcx>: Sized {
27
27
tcx : TyCtxt < ' tcx > ,
28
28
) -> Result < ( Self , clean:: Crate ) , Error > ;
29
29
30
- /// Make a new renderer to render a child of the item currently being rendered.
31
- fn make_child_renderer ( & self ) -> Self ;
32
-
33
30
/// Renders a single non-module item. This means no recursive sub-item rendering is required.
34
31
fn item ( & mut self , item : clean:: Item ) -> Result < ( ) , Error > ;
35
32
@@ -57,7 +54,7 @@ crate fn run_format<'tcx, T: FormatRenderer<'tcx>>(
57
54
let prof = & tcx. sess . prof ;
58
55
59
56
let emit_crate = options. should_emit_crate ( ) ;
60
- let ( mut format_renderer , krate) = prof
57
+ let ( mut cx , krate) = prof
61
58
. extra_verbose_generic_activity ( "create_renderer" , T :: descr ( ) )
62
59
. run ( || T :: init ( krate, options, cache, tcx) ) ?;
63
60
@@ -66,10 +63,10 @@ crate fn run_format<'tcx, T: FormatRenderer<'tcx>>(
66
63
}
67
64
68
65
// Render the crate documentation
69
- let mut work = vec ! [ ( format_renderer . make_child_renderer ( ) , krate. module) ] ;
66
+ let mut work = vec ! [ krate. module] ;
70
67
71
68
let unknown = Symbol :: intern ( "<unknown item>" ) ;
72
- while let Some ( ( mut cx , item) ) = work. pop ( ) {
69
+ while let Some ( item) = work. pop ( ) {
73
70
if item. is_mod ( ) && T :: RUN_ON_MODULE {
74
71
// modules are special because they add a namespace. We also need to
75
72
// recurse into the items of the module as well.
@@ -81,11 +78,7 @@ crate fn run_format<'tcx, T: FormatRenderer<'tcx>>(
81
78
clean:: StrippedItem ( box clean:: ModuleItem ( m) ) | clean:: ModuleItem ( m) => m,
82
79
_ => unreachable ! ( ) ,
83
80
} ;
84
- for it in module. items {
85
- debug ! ( "Adding {:?} to worklist" , it. name) ;
86
- work. push ( ( cx. make_child_renderer ( ) , it) ) ;
87
- }
88
-
81
+ work. extend ( module. items ) ;
89
82
cx. mod_item_out ( ) ?;
90
83
// FIXME: checking `item.name.is_some()` is very implicit and leads to lots of special
91
84
// cases. Use an explicit match instead.
@@ -95,5 +88,5 @@ crate fn run_format<'tcx, T: FormatRenderer<'tcx>>(
95
88
}
96
89
}
97
90
prof. extra_verbose_generic_activity ( "renderer_after_krate" , T :: descr ( ) )
98
- . run ( || format_renderer . after_krate ( ) )
91
+ . run ( || cx . after_krate ( ) )
99
92
}
0 commit comments