@@ -11,7 +11,7 @@ use rustc_middle::ty::TyCtxt;
1111use rustc_session:: Session ;
1212use rustc_span:: edition:: Edition ;
1313use rustc_span:: source_map:: FileName ;
14- use rustc_span:: symbol:: sym;
14+ use rustc_span:: { symbol:: sym, Symbol } ;
1515
1616use super :: cache:: { build_index, ExternalLocation } ;
1717use super :: print_item:: { full_path, item_path, print_item} ;
@@ -343,29 +343,27 @@ impl<'tcx> FormatRenderer<'tcx> for Context<'tcx> {
343343
344344 // Crawl the crate attributes looking for attributes which control how we're
345345 // 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 ;
368365 }
366+ _ => { }
369367 }
370368 }
371369 let ( sender, receiver) = channel ( ) ;
@@ -447,12 +445,11 @@ impl<'tcx> FormatRenderer<'tcx> for Context<'tcx> {
447445
448446 fn after_krate (
449447 & mut self ,
450- krate : & clean :: Crate ,
448+ crate_name : Symbol ,
451449 diag : & rustc_errors:: Handler ,
452450 ) -> 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" ) ;
454452 let settings_file = self . dst . join ( "settings.html" ) ;
455- let crate_name = krate. name ;
456453
457454 let mut root_path = self . dst . to_str ( ) . expect ( "invalid path" ) . to_owned ( ) ;
458455 if !root_path. ends_with ( '/' ) {
@@ -515,9 +512,9 @@ impl<'tcx> FormatRenderer<'tcx> for Context<'tcx> {
515512 if let Some ( ref redirections) = self . shared . redirections {
516513 if !redirections. borrow ( ) . is_empty ( ) {
517514 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" ) ;
519516 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 ( ) ) ) ?;
521518 self . shared . fs . write ( & redirect_map_path, paths. as_bytes ( ) ) ?;
522519 }
523520 }
0 commit comments