@@ -569,7 +569,7 @@ fn generate_macro_def_id_path(
569569 root_path : Option < & str > ,
570570) -> Result < ( String , ItemType , Vec < Symbol > ) , HrefError > {
571571 let tcx = cx. shared . tcx ;
572- let crate_name = tcx. crate_name ( def_id. krate ) . to_string ( ) ;
572+ let crate_name = tcx. crate_name ( def_id. krate ) ;
573573 let cache = cx. cache ( ) ;
574574
575575 let fqp: Vec < Symbol > = tcx
@@ -584,7 +584,7 @@ fn generate_macro_def_id_path(
584584 }
585585 } )
586586 . collect ( ) ;
587- let mut relative = fqp. iter ( ) . map ( |elem| elem . to_string ( ) ) ;
587+ let mut relative = fqp. iter ( ) . copied ( ) ;
588588 let cstore = CStore :: from_tcx ( tcx) ;
589589 // We need this to prevent a `panic` when this function is used from intra doc links...
590590 if !cstore. has_crate_data ( def_id. krate ) {
@@ -602,9 +602,9 @@ fn generate_macro_def_id_path(
602602 } ;
603603
604604 let mut path = if is_macro_2 {
605- once ( crate_name. clone ( ) ) . chain ( relative) . collect ( )
605+ once ( crate_name) . chain ( relative) . collect ( )
606606 } else {
607- vec ! [ crate_name. clone ( ) , relative. next_back( ) . unwrap( ) ]
607+ vec ! [ crate_name, relative. next_back( ) . unwrap( ) ]
608608 } ;
609609 if path. len ( ) < 2 {
610610 // The minimum we can have is the crate name followed by the macro name. If shorter, then
@@ -614,17 +614,22 @@ fn generate_macro_def_id_path(
614614 }
615615
616616 if let Some ( last) = path. last_mut ( ) {
617- * last = format ! ( "macro.{}.html" , last) ;
617+ * last = Symbol :: intern ( & format ! ( "macro.{}.html" , last. as_str ( ) ) ) ;
618618 }
619619
620620 let url = match cache. extern_locations [ & def_id. krate ] {
621621 ExternalLocation :: Remote ( ref s) => {
622622 // `ExternalLocation::Remote` always end with a `/`.
623- format ! ( "{}{}" , s, path. join( "/" ) )
623+ format ! ( "{}{}" , s, path. iter ( ) . map ( |p| p . as_str ( ) ) . join( "/" ) )
624624 }
625625 ExternalLocation :: Local => {
626626 // `root_path` always end with a `/`.
627- format ! ( "{}{}/{}" , root_path. unwrap_or( "" ) , crate_name, path. join( "/" ) )
627+ format ! (
628+ "{}{}/{}" ,
629+ root_path. unwrap_or( "" ) ,
630+ crate_name,
631+ path. iter( ) . map( |p| p. as_str( ) ) . join( "/" )
632+ )
628633 }
629634 ExternalLocation :: Unknown => {
630635 debug ! ( "crate {} not in cache when linkifying macros" , crate_name) ;
@@ -1050,7 +1055,7 @@ fn fmt_type<'cx>(
10501055 _ => String :: new ( ) ,
10511056 } ;
10521057 let m = mutability. print_with_space ( ) ;
1053- let amp = if f. alternate ( ) { "&" . to_string ( ) } else { "&" . to_string ( ) } ;
1058+ let amp = if f. alternate ( ) { "&" } else { "&" } ;
10541059 match * * ty {
10551060 clean:: DynTrait ( ref bounds, ref trait_lt)
10561061 if bounds. len ( ) > 1 || trait_lt. is_some ( ) =>
0 commit comments