@@ -56,7 +56,7 @@ pub(crate) trait FormatRenderer<'tcx>: Sized {
5656 fn restore_module_data ( & mut self , info : Self :: ModuleData ) ;
5757
5858 /// 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 > ;
6060
6161 /// Renders a module (should not handle recursing into children).
6262 fn mod_item_in ( & mut self , item : & clean:: Item ) -> Result < ( ) , Error > ;
@@ -67,14 +67,14 @@ pub(crate) trait FormatRenderer<'tcx>: Sized {
6767 }
6868
6969 /// 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 > ;
7171
7272 fn cache ( & self ) -> & Cache ;
7373}
7474
7575fn run_format_inner < ' tcx , T : FormatRenderer < ' tcx > > (
7676 cx : & mut T ,
77- item : clean:: Item ,
77+ item : & clean:: Item ,
7878 prof : & SelfProfilerRef ,
7979) -> Result < ( ) , Error > {
8080 if item. is_mod ( ) && T :: RUN_ON_MODULE {
@@ -84,12 +84,12 @@ fn run_format_inner<'tcx, T: FormatRenderer<'tcx>>(
8484 prof. generic_activity_with_arg ( "render_mod_item" , item. name . unwrap ( ) . to_string ( ) ) ;
8585
8686 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
8989 else {
9090 unreachable ! ( )
9191 } ;
92- for it in module. items {
92+ for it in module. items . iter ( ) {
9393 let info = cx. save_module_data ( ) ;
9494 run_format_inner ( cx, it, prof) ?;
9595 cx. restore_module_data ( info) ;
@@ -101,7 +101,7 @@ fn run_format_inner<'tcx, T: FormatRenderer<'tcx>>(
101101 } else if let Some ( item_name) = item. name
102102 && !item. is_extern_crate ( )
103103 {
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) ) ?;
105105 }
106106 Ok ( ( ) )
107107}
@@ -125,7 +125,7 @@ pub(crate) fn run_format<'tcx, T: FormatRenderer<'tcx>>(
125125 }
126126
127127 // Render the crate documentation
128- run_format_inner ( & mut format_renderer, krate. module , prof) ?;
128+ run_format_inner ( & mut format_renderer, & krate. module , prof) ?;
129129
130130 prof. verbose_generic_activity_with_arg ( "renderer_after_krate" , T :: descr ( ) )
131131 . run ( || format_renderer. after_krate ( ) )
0 commit comments