@@ -24,6 +24,7 @@ use tracing::instrument;
2424
2525use crate :: clean:: types:: { Function , Generics , ItemId , Type , WherePredicate } ;
2626use crate :: clean:: { self , utils} ;
27+ use crate :: config:: ShouldMerge ;
2728use crate :: error:: Error ;
2829use crate :: formats:: cache:: { Cache , OrphanImplItem } ;
2930use crate :: formats:: item_type:: ItemType ;
@@ -722,11 +723,7 @@ impl SerializedSearchIndex {
722723 } ,
723724 ) ,
724725 self . alias_pointers [ id] . and_then ( |alias| {
725- if self . names [ alias] . is_empty ( ) {
726- None
727- } else {
728- map. get ( & alias) . copied ( )
729- }
726+ if self . names [ alias] . is_empty ( ) { None } else { map. get ( & alias) . copied ( ) }
730727 } ) ,
731728 ) ;
732729 }
@@ -1254,6 +1251,7 @@ pub(crate) fn build_index(
12541251 tcx : TyCtxt < ' _ > ,
12551252 doc_root : & Path ,
12561253 resource_suffix : & str ,
1254+ should_merge : & ShouldMerge ,
12571255) -> Result < SerializedSearchIndex , Error > {
12581256 let mut search_index = std:: mem:: take ( & mut cache. search_index ) ;
12591257
@@ -1304,7 +1302,11 @@ pub(crate) fn build_index(
13041302 //
13051303 // if there's already a search index, load it into memory and add the new entries to it
13061304 // otherwise, do nothing
1307- let mut serialized_index = SerializedSearchIndex :: load ( doc_root, resource_suffix) ?;
1305+ let mut serialized_index = if should_merge. read_rendered_cci {
1306+ SerializedSearchIndex :: load ( doc_root, resource_suffix) ?
1307+ } else {
1308+ SerializedSearchIndex :: default ( )
1309+ } ;
13081310
13091311 // The crate always goes first in this list
13101312 let crate_name = krate. name ( tcx) ;
0 commit comments