@@ -61,7 +61,7 @@ use rustc_session::Session;
61
61
use rustc_span:: edition:: Edition ;
62
62
use rustc_span:: hygiene:: MacroKind ;
63
63
use rustc_span:: source_map:: FileName ;
64
- use rustc_span:: symbol:: { sym, Symbol } ;
64
+ use rustc_span:: symbol:: { kw , sym, Symbol } ;
65
65
use serde:: ser:: SerializeSeq ;
66
66
use serde:: { Serialize , Serializer } ;
67
67
@@ -665,7 +665,7 @@ impl FormatRenderer for Context {
665
665
if !buf. is_empty ( ) {
666
666
let name = item. name . as_ref ( ) . unwrap ( ) ;
667
667
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 ( ) ) ;
669
669
self . shared . ensure_dir ( & self . dst ) ?;
670
670
let joint_dst = self . dst . join ( file_name) ;
671
671
self . shared . fs . write ( & joint_dst, buf. as_bytes ( ) ) ?;
@@ -1543,7 +1543,7 @@ impl Context {
1543
1543
if !title. is_empty ( ) {
1544
1544
title. push_str ( "::" ) ;
1545
1545
}
1546
- title. push_str ( it. name . as_ref ( ) . unwrap ( ) ) ;
1546
+ title. push_str ( & it. name . unwrap ( ) . as_str ( ) ) ;
1547
1547
}
1548
1548
title. push_str ( " - Rust" ) ;
1549
1549
let tyname = it. type_ ( ) ;
@@ -1815,7 +1815,7 @@ fn item_path(ty: ItemType, name: &str) -> String {
1815
1815
fn full_path ( cx : & Context , item : & clean:: Item ) -> String {
1816
1816
let mut s = cx. current . join ( "::" ) ;
1817
1817
s. push_str ( "::" ) ;
1818
- s. push_str ( item. name . as_ref ( ) . unwrap ( ) ) ;
1818
+ s. push_str ( & item. name . unwrap ( ) . as_str ( ) ) ;
1819
1819
s
1820
1820
}
1821
1821
@@ -2065,9 +2065,9 @@ fn item_module(w: &mut Buffer, cx: &Context, item: &clean::Item, items: &[clean:
2065
2065
( true , false ) => return Ordering :: Greater ,
2066
2066
}
2067
2067
}
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)
2071
2071
}
2072
2072
2073
2073
if cx. shared . sort_modules_alphabetically {
@@ -2191,7 +2191,7 @@ fn item_module(w: &mut Buffer, cx: &Context, item: &clean::Item, items: &[clean:
2191
2191
add = add,
2192
2192
stab = stab. unwrap_or_else( String :: new) ,
2193
2193
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 ( ) ) ,
2195
2195
title = [ full_path( cx, myitem) , myitem. type_( ) . to_string( ) ]
2196
2196
. iter( )
2197
2197
. 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,
2623
2623
2624
2624
fn trait_item ( w : & mut Buffer , cx : & Context , m : & clean:: Item , t : & clean:: Item , cache : & Cache ) {
2625
2625
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) ;
2627
2627
let item_type = m. type_ ( ) ;
2628
2628
let id = cx. derive_id ( format ! ( "{}.{}" , item_type, name) ) ;
2629
2629
write ! ( w, "<h3 id=\" {id}\" class=\" method\" ><code>" , id = id, ) ;
@@ -2951,7 +2951,7 @@ fn render_assoc_item(
2951
2951
AssocItemLink :: GotoSource ( did, provided_methods) => {
2952
2952
// We're creating a link from an impl-item to the corresponding
2953
2953
// 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 ( ) ) {
2955
2955
ItemType :: Method
2956
2956
} else {
2957
2957
ItemType :: TyMethod
@@ -3434,10 +3434,7 @@ fn render_assoc_items(
3434
3434
what : AssocItemRender < ' _ > ,
3435
3435
cache : & Cache ,
3436
3436
) {
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) ;
3441
3438
let v = match cache. impls . get ( & it) {
3442
3439
Some ( v) => v,
3443
3440
None => return ,
@@ -4139,7 +4136,7 @@ fn print_sidebar(cx: &Context, it: &clean::Item, buffer: &mut Buffer, cache: &Ca
4139
4136
ty: \" {ty}\" , \
4140
4137
relpath: \" {path}\" \
4141
4138
}};</script>",
4142
- name = it. name. as_ref ( ) . map ( |x| & x [ .. ] ) . unwrap_or( "" ) ,
4139
+ name = it. name. unwrap_or( kw :: Invalid ) ,
4143
4140
ty = it. type_( ) ,
4144
4141
path = relpath
4145
4142
) ;
0 commit comments