@@ -61,7 +61,7 @@ use rustc_session::Session;
6161use rustc_span:: edition:: Edition ;
6262use rustc_span:: hygiene:: MacroKind ;
6363use rustc_span:: source_map:: FileName ;
64- use rustc_span:: symbol:: { sym, Symbol } ;
64+ use rustc_span:: symbol:: { kw , sym, Symbol } ;
6565use serde:: ser:: SerializeSeq ;
6666use serde:: { Serialize , Serializer } ;
6767
@@ -665,7 +665,7 @@ impl FormatRenderer for Context {
665665 if !buf. is_empty ( ) {
666666 let name = item. name . as_ref ( ) . unwrap ( ) ;
667667 let item_type = item. type_ ( ) ;
668- let file_name = & item_path ( item_type, name) ;
668+ let file_name = & item_path ( item_type, & name. as_str ( ) ) ;
669669 self . shared . ensure_dir ( & self . dst ) ?;
670670 let joint_dst = self . dst . join ( file_name) ;
671671 self . shared . fs . write ( & joint_dst, buf. as_bytes ( ) ) ?;
@@ -1543,7 +1543,7 @@ impl Context {
15431543 if !title. is_empty ( ) {
15441544 title. push_str ( "::" ) ;
15451545 }
1546- title. push_str ( it. name . as_ref ( ) . unwrap ( ) ) ;
1546+ title. push_str ( & it. name . unwrap ( ) . as_str ( ) ) ;
15471547 }
15481548 title. push_str ( " - Rust" ) ;
15491549 let tyname = it. type_ ( ) ;
@@ -1815,7 +1815,7 @@ fn item_path(ty: ItemType, name: &str) -> String {
18151815fn full_path ( cx : & Context , item : & clean:: Item ) -> String {
18161816 let mut s = cx. current . join ( "::" ) ;
18171817 s. push_str ( "::" ) ;
1818- s. push_str ( item. name . as_ref ( ) . unwrap ( ) ) ;
1818+ s. push_str ( & item. name . unwrap ( ) . as_str ( ) ) ;
18191819 s
18201820}
18211821
@@ -2065,9 +2065,9 @@ fn item_module(w: &mut Buffer, cx: &Context, item: &clean::Item, items: &[clean:
20652065 ( true , false ) => return Ordering :: Greater ,
20662066 }
20672067 }
2068- let lhs = i1. name . as_ref ( ) . map_or ( "" , |s| & * * s ) ;
2069- let rhs = i2. name . as_ref ( ) . map_or ( "" , |s| & * * s ) ;
2070- compare_names ( lhs, rhs)
2068+ let lhs = i1. name . unwrap_or ( kw :: Invalid ) . as_str ( ) ;
2069+ let rhs = i2. name . unwrap_or ( kw :: Invalid ) . as_str ( ) ;
2070+ compare_names ( & lhs, & rhs)
20712071 }
20722072
20732073 if cx. shared . sort_modules_alphabetically {
@@ -2191,7 +2191,7 @@ fn item_module(w: &mut Buffer, cx: &Context, item: &clean::Item, items: &[clean:
21912191 add = add,
21922192 stab = stab. unwrap_or_else( String :: new) ,
21932193 unsafety_flag = unsafety_flag,
2194- href = item_path( myitem. type_( ) , myitem. name. as_ref ( ) . unwrap ( ) ) ,
2194+ href = item_path( myitem. type_( ) , & myitem. name. unwrap ( ) . as_str ( ) ) ,
21952195 title = [ full_path( cx, myitem) , myitem. type_( ) . to_string( ) ]
21962196 . iter( )
21972197 . filter_map( |s| if !s. is_empty( ) { Some ( s. as_str( ) ) } else { None } )
@@ -2623,7 +2623,7 @@ fn item_trait(w: &mut Buffer, cx: &Context, it: &clean::Item, t: &clean::Trait,
26232623
26242624 fn trait_item ( w : & mut Buffer , cx : & Context , m : & clean:: Item , t : & clean:: Item , cache : & Cache ) {
26252625 let name = m. name . as_ref ( ) . unwrap ( ) ;
2626- info ! ( "Documenting {} on {}" , name, t. name. as_deref ( ) . unwrap_or_default ( ) ) ;
2626+ info ! ( "Documenting {} on {:? }" , name, t. name) ;
26272627 let item_type = m. type_ ( ) ;
26282628 let id = cx. derive_id ( format ! ( "{}.{}" , item_type, name) ) ;
26292629 write ! ( w, "<h3 id=\" {id}\" class=\" method\" ><code>" , id = id, ) ;
@@ -2951,7 +2951,7 @@ fn render_assoc_item(
29512951 AssocItemLink :: GotoSource ( did, provided_methods) => {
29522952 // We're creating a link from an impl-item to the corresponding
29532953 // trait-item and need to map the anchored type accordingly.
2954- let ty = if provided_methods. contains ( name) {
2954+ let ty = if provided_methods. contains ( & * name. as_str ( ) ) {
29552955 ItemType :: Method
29562956 } else {
29572957 ItemType :: TyMethod
@@ -3434,10 +3434,7 @@ fn render_assoc_items(
34343434 what : AssocItemRender < ' _ > ,
34353435 cache : & Cache ,
34363436) {
3437- info ! (
3438- "Documenting associated items of {}" ,
3439- containing_item. name. as_deref( ) . unwrap_or_default( )
3440- ) ;
3437+ info ! ( "Documenting associated items of {:?}" , containing_item. name) ;
34413438 let v = match cache. impls . get ( & it) {
34423439 Some ( v) => v,
34433440 None => return ,
@@ -4139,7 +4136,7 @@ fn print_sidebar(cx: &Context, it: &clean::Item, buffer: &mut Buffer, cache: &Ca
41394136 ty: \" {ty}\" , \
41404137 relpath: \" {path}\" \
41414138 }};</script>",
4142- name = it. name. as_ref ( ) . map ( |x| & x [ .. ] ) . unwrap_or( "" ) ,
4139+ name = it. name. unwrap_or( kw :: Invalid ) ,
41434140 ty = it. type_( ) ,
41444141 path = relpath
41454142 ) ;
0 commit comments