@@ -7,7 +7,6 @@ use rustc_middle::ty::TyCtxt;
7
7
use rustc_span:: symbol:: sym;
8
8
9
9
use crate :: clean:: { self , ExternalCrate , ItemId , PrimitiveType } ;
10
- use crate :: config:: RenderOptions ;
11
10
use crate :: core:: DocContext ;
12
11
use crate :: fold:: DocFolder ;
13
12
use crate :: formats:: item_type:: ItemType ;
@@ -145,23 +144,20 @@ impl Cache {
145
144
debug ! ( ?cx. cache. crate_version) ;
146
145
cx. cache . traits = krate. external_traits . take ( ) ;
147
146
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
-
158
147
// Cache where all our extern crates are located
159
148
// 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
+
161
154
let name = e. name ( tcx) ;
155
+ let render_options = & cx. render_options ;
162
156
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) ;
165
161
cx. cache . extern_locations . insert ( e. crate_num , location) ;
166
162
cx. cache . external_paths . insert ( e. def_id ( ) , ( vec ! [ name. to_string( ) ] , ItemType :: Module ) ) ;
167
163
}
0 commit comments