@@ -36,19 +36,18 @@ use crate::formats::cache::Cache;
3636use crate :: json:: conversions:: IntoJson ;
3737use crate :: { clean, try_err} ;
3838
39- #[ derive( Clone ) ]
4039pub ( crate ) struct JsonRenderer < ' tcx > {
4140 tcx : TyCtxt < ' tcx > ,
4241 /// A mapping of IDs that contains all local items for this crate which gets output as a top
4342 /// level field of the JSON blob.
44- index : Rc < RefCell < FxHashMap < types:: Id , types:: Item > > > ,
43+ index : FxHashMap < types:: Id , types:: Item > ,
4544 /// The directory where the JSON blob should be written to.
4645 ///
4746 /// If this is `None`, the blob will be printed to `stdout` instead.
4847 out_dir : Option < PathBuf > ,
4948 cache : Rc < Cache > ,
5049 imported_items : DefIdSet ,
51- id_interner : Rc < RefCell < ids:: IdInterner > > ,
50+ id_interner : RefCell < ids:: IdInterner > ,
5251}
5352
5453impl < ' tcx > JsonRenderer < ' tcx > {
@@ -197,7 +196,7 @@ impl<'tcx> FormatRenderer<'tcx> for JsonRenderer<'tcx> {
197196 Ok ( (
198197 JsonRenderer {
199198 tcx,
200- index : Rc :: new ( RefCell :: new ( FxHashMap :: default ( ) ) ) ,
199+ index : FxHashMap :: default ( ) ,
201200 out_dir : if options. output_to_stdout { None } else { Some ( options. output ) } ,
202201 cache : Rc :: new ( cache) ,
203202 imported_items,
@@ -272,7 +271,7 @@ impl<'tcx> FormatRenderer<'tcx> for JsonRenderer<'tcx> {
272271 | types:: ItemEnum :: Macro ( _)
273272 | types:: ItemEnum :: ProcMacro ( _) => false ,
274273 } ;
275- let removed = self . index . borrow_mut ( ) . insert ( new_item. id , new_item. clone ( ) ) ;
274+ let removed = self . index . insert ( new_item. id , new_item. clone ( ) ) ;
276275
277276 // FIXME(adotinthevoid): Currently, the index is duplicated. This is a sanity check
278277 // to make sure the items are unique. The main place this happens is when an item, is
@@ -295,11 +294,11 @@ impl<'tcx> FormatRenderer<'tcx> for JsonRenderer<'tcx> {
295294 unreachable ! ( "RUN_ON_MODULE = false, should never call mod_item_in" )
296295 }
297296
298- fn after_krate ( & mut self ) -> Result < ( ) , Error > {
297+ fn after_krate ( self ) -> Result < ( ) , Error > {
299298 debug ! ( "Done with crate" ) ;
300299
301300 let e = ExternalCrate { crate_num : LOCAL_CRATE } ;
302- let index = ( * self . index ) . clone ( ) . into_inner ( ) ;
301+ let index = self . index . clone ( ) ;
303302
304303 // Note that tcx.rust_target_features is inappropriate here because rustdoc tries to run for
305304 // multiple targets: https://github.com/rust-lang/rust/pull/137632
@@ -324,7 +323,7 @@ impl<'tcx> FormatRenderer<'tcx> for JsonRenderer<'tcx> {
324323 types:: ItemSummary {
325324 crate_id : k. krate . as_u32 ( ) ,
326325 path : path. iter ( ) . map ( |s| s. to_string ( ) ) . collect ( ) ,
327- kind : kind. into_json ( self ) ,
326+ kind : kind. into_json ( & self ) ,
328327 } ,
329328 )
330329 } )
0 commit comments