@@ -56,7 +56,7 @@ pub(crate) trait FormatRenderer<'tcx>: Sized {
56
56
fn restore_module_data ( & mut self , info : Self :: ModuleData ) ;
57
57
58
58
/// Renders a single non-module item. This means no recursive sub-item rendering is required.
59
- fn item ( & mut self , item : clean:: Item ) -> Result < ( ) , Error > ;
59
+ fn item ( & mut self , item : & clean:: Item ) -> Result < ( ) , Error > ;
60
60
61
61
/// Renders a module (should not handle recursing into children).
62
62
fn mod_item_in ( & mut self , item : & clean:: Item ) -> Result < ( ) , Error > ;
@@ -67,14 +67,14 @@ pub(crate) trait FormatRenderer<'tcx>: Sized {
67
67
}
68
68
69
69
/// Post processing hook for cleanup and dumping output to files.
70
- fn after_krate ( & mut self ) -> Result < ( ) , Error > ;
70
+ fn after_krate ( self ) -> Result < ( ) , Error > ;
71
71
72
72
fn cache ( & self ) -> & Cache ;
73
73
}
74
74
75
75
fn run_format_inner < ' tcx , T : FormatRenderer < ' tcx > > (
76
76
cx : & mut T ,
77
- item : clean:: Item ,
77
+ item : & clean:: Item ,
78
78
prof : & SelfProfilerRef ,
79
79
) -> Result < ( ) , Error > {
80
80
if item. is_mod ( ) && T :: RUN_ON_MODULE {
@@ -84,12 +84,12 @@ fn run_format_inner<'tcx, T: FormatRenderer<'tcx>>(
84
84
prof. generic_activity_with_arg ( "render_mod_item" , item. name . unwrap ( ) . to_string ( ) ) ;
85
85
86
86
cx. mod_item_in ( & item) ?;
87
- let ( clean:: StrippedItem ( box clean:: ModuleItem ( module ) ) | clean :: ModuleItem ( module) ) =
88
- item. inner . kind
87
+ let ( clean:: StrippedItem ( box clean:: ModuleItem ( ref module) )
88
+ | clean :: ModuleItem ( ref module ) ) = item. inner . kind
89
89
else {
90
90
unreachable ! ( )
91
91
} ;
92
- for it in module. items {
92
+ for it in module. items . iter ( ) {
93
93
let info = cx. save_module_data ( ) ;
94
94
run_format_inner ( cx, it, prof) ?;
95
95
cx. restore_module_data ( info) ;
@@ -101,7 +101,7 @@ fn run_format_inner<'tcx, T: FormatRenderer<'tcx>>(
101
101
} else if let Some ( item_name) = item. name
102
102
&& !item. is_extern_crate ( )
103
103
{
104
- prof. generic_activity_with_arg ( "render_item" , item_name. as_str ( ) ) . run ( || cx. item ( item) ) ?;
104
+ prof. generic_activity_with_arg ( "render_item" , item_name. as_str ( ) ) . run ( || cx. item ( & item) ) ?;
105
105
}
106
106
Ok ( ( ) )
107
107
}
@@ -125,7 +125,7 @@ pub(crate) fn run_format<'tcx, T: FormatRenderer<'tcx>>(
125
125
}
126
126
127
127
// Render the crate documentation
128
- run_format_inner ( & mut format_renderer, krate. module , prof) ?;
128
+ run_format_inner ( & mut format_renderer, & krate. module , prof) ?;
129
129
130
130
prof. verbose_generic_activity_with_arg ( "renderer_after_krate" , T :: descr ( ) )
131
131
. run ( || format_renderer. after_krate ( ) )
0 commit comments