@@ -11,7 +11,7 @@ use rustc_middle::ty::TyCtxt;
11
11
use rustc_session:: Session ;
12
12
use rustc_span:: edition:: Edition ;
13
13
use rustc_span:: source_map:: FileName ;
14
- use rustc_span:: symbol:: sym;
14
+ use rustc_span:: { symbol:: sym, Symbol } ;
15
15
16
16
use super :: cache:: { build_index, ExternalLocation } ;
17
17
use super :: print_item:: { full_path, item_path, print_item} ;
@@ -343,29 +343,27 @@ impl<'tcx> FormatRenderer<'tcx> for Context<'tcx> {
343
343
344
344
// Crawl the crate attributes looking for attributes which control how we're
345
345
// going to emit HTML
346
- if let Some ( attrs) = krate. module . as_ref ( ) . map ( |m| & m. attrs ) {
347
- for attr in attrs. lists ( sym:: doc) {
348
- match ( attr. name_or_empty ( ) , attr. value_str ( ) ) {
349
- ( sym:: html_favicon_url, Some ( s) ) => {
350
- layout. favicon = s. to_string ( ) ;
351
- }
352
- ( sym:: html_logo_url, Some ( s) ) => {
353
- layout. logo = s. to_string ( ) ;
354
- }
355
- ( sym:: html_playground_url, Some ( s) ) => {
356
- playground = Some ( markdown:: Playground {
357
- crate_name : Some ( krate. name . to_string ( ) ) ,
358
- url : s. to_string ( ) ,
359
- } ) ;
360
- }
361
- ( sym:: issue_tracker_base_url, Some ( s) ) => {
362
- issue_tracker_base_url = Some ( s. to_string ( ) ) ;
363
- }
364
- ( sym:: html_no_source, None ) if attr. is_word ( ) => {
365
- include_sources = false ;
366
- }
367
- _ => { }
346
+ for attr in krate. module . attrs . lists ( sym:: doc) {
347
+ match ( attr. name_or_empty ( ) , attr. value_str ( ) ) {
348
+ ( sym:: html_favicon_url, Some ( s) ) => {
349
+ layout. favicon = s. to_string ( ) ;
350
+ }
351
+ ( sym:: html_logo_url, Some ( s) ) => {
352
+ layout. logo = s. to_string ( ) ;
353
+ }
354
+ ( sym:: html_playground_url, Some ( s) ) => {
355
+ playground = Some ( markdown:: Playground {
356
+ crate_name : Some ( krate. name . to_string ( ) ) ,
357
+ url : s. to_string ( ) ,
358
+ } ) ;
359
+ }
360
+ ( sym:: issue_tracker_base_url, Some ( s) ) => {
361
+ issue_tracker_base_url = Some ( s. to_string ( ) ) ;
362
+ }
363
+ ( sym:: html_no_source, None ) if attr. is_word ( ) => {
364
+ include_sources = false ;
368
365
}
366
+ _ => { }
369
367
}
370
368
}
371
369
let ( sender, receiver) = channel ( ) ;
@@ -447,12 +445,11 @@ impl<'tcx> FormatRenderer<'tcx> for Context<'tcx> {
447
445
448
446
fn after_krate (
449
447
& mut self ,
450
- krate : & clean :: Crate ,
448
+ crate_name : Symbol ,
451
449
diag : & rustc_errors:: Handler ,
452
450
) -> Result < ( ) , Error > {
453
- let final_file = self . dst . join ( & * krate . name . as_str ( ) ) . join ( "all.html" ) ;
451
+ let final_file = self . dst . join ( & * crate_name . as_str ( ) ) . join ( "all.html" ) ;
454
452
let settings_file = self . dst . join ( "settings.html" ) ;
455
- let crate_name = krate. name ;
456
453
457
454
let mut root_path = self . dst . to_str ( ) . expect ( "invalid path" ) . to_owned ( ) ;
458
455
if !root_path. ends_with ( '/' ) {
@@ -515,9 +512,9 @@ impl<'tcx> FormatRenderer<'tcx> for Context<'tcx> {
515
512
if let Some ( ref redirections) = self . shared . redirections {
516
513
if !redirections. borrow ( ) . is_empty ( ) {
517
514
let redirect_map_path =
518
- self . dst . join ( & * krate . name . as_str ( ) ) . join ( "redirect-map.json" ) ;
515
+ self . dst . join ( & * crate_name . as_str ( ) ) . join ( "redirect-map.json" ) ;
519
516
let paths = serde_json:: to_string ( & * redirections. borrow ( ) ) . unwrap ( ) ;
520
- self . shared . ensure_dir ( & self . dst . join ( & * krate . name . as_str ( ) ) ) ?;
517
+ self . shared . ensure_dir ( & self . dst . join ( & * crate_name . as_str ( ) ) ) ?;
521
518
self . shared . fs . write ( & redirect_map_path, paths. as_bytes ( ) ) ?;
522
519
}
523
520
}
0 commit comments