@@ -7,7 +7,6 @@ use rustc_middle::ty::TyCtxt;
77use rustc_span:: symbol:: sym;
88
99use crate :: clean:: { self , ExternalCrate , ItemId , PrimitiveType } ;
10- use crate :: config:: RenderOptions ;
1110use crate :: core:: DocContext ;
1211use crate :: fold:: DocFolder ;
1312use crate :: formats:: item_type:: ItemType ;
@@ -145,23 +144,20 @@ impl Cache {
145144 debug ! ( ?cx. cache. crate_version) ;
146145 cx. cache . traits = krate. external_traits . take ( ) ;
147146
148- let mut externs = Vec :: new ( ) ;
149- for & cnum in cx. tcx . crates ( ( ) ) {
150- externs. push ( ExternalCrate { crate_num : cnum } ) ;
151- // Analyze doc-reachability for extern items
152- LibEmbargoVisitor :: new ( cx) . visit_lib ( cnum) ;
153- }
154-
155- let RenderOptions { extern_html_root_takes_precedence, output : dst, .. } =
156- & cx. render_options ;
157-
158147 // Cache where all our extern crates are located
159148 // FIXME: this part is specific to HTML so it'd be nice to remove it from the common code
160- for e in externs {
149+ for & crate_num in cx. tcx . crates ( ( ) ) {
150+ let e = ExternalCrate { crate_num } ;
151+ // Analyze doc-reachability for extern items
152+ LibEmbargoVisitor :: new ( cx) . visit_lib ( e. crate_num ) ;
153+
161154 let name = e. name ( tcx) ;
155+ let render_options = & cx. render_options ;
162156 let extern_url =
163- cx. render_options . extern_html_root_urls . get ( & * name. as_str ( ) ) . map ( |u| & * * u) ;
164- let location = e. location ( extern_url, * extern_html_root_takes_precedence, dst, tcx) ;
157+ render_options. extern_html_root_urls . get ( & * name. as_str ( ) ) . map ( |u| & * * u) ;
158+ let extern_url_takes_precedence = render_options. extern_html_root_takes_precedence ;
159+ let dst = & render_options. output ;
160+ let location = e. location ( extern_url, extern_url_takes_precedence, dst, tcx) ;
165161 cx. cache . extern_locations . insert ( e. crate_num , location) ;
166162 cx. cache . external_paths . insert ( e. def_id ( ) , ( vec ! [ name. to_string( ) ] , ItemType :: Module ) ) ;
167163 }
0 commit comments