@@ -263,7 +263,7 @@ fn item_module(w: &mut Buffer, cx: &Context<'_>, item: &clean::Item, items: &[cl
263
263
indices. dedup_by_key ( |i| {
264
264
(
265
265
items[ * i] . def_id ,
266
- if items[ * i] . name . as_ref ( ) . is_some ( ) { Some ( full_path ( cx, & items[ * i] ) ) } else { None } ,
266
+ if items[ * i] . name . is_some ( ) { Some ( full_path ( cx, & items[ * i] ) ) } else { None } ,
267
267
items[ * i] . type_ ( ) ,
268
268
if items[ * i] . is_import ( ) { * i } else { 0 } ,
269
269
)
@@ -310,13 +310,13 @@ fn item_module(w: &mut Buffer, cx: &Context<'_>, item: &clean::Item, items: &[cl
310
310
"<div class=\" item-left\" ><code>{}extern crate {} as {};" ,
311
311
myitem. visibility. print_with_space( myitem. def_id, cx) ,
312
312
anchor( myitem. def_id. expect_def_id( ) , src, cx) ,
313
- myitem. name. as_ref ( ) . unwrap( ) ,
313
+ myitem. name. unwrap( ) ,
314
314
) ,
315
315
None => write ! (
316
316
w,
317
317
"<div class=\" item-left\" ><code>{}extern crate {};" ,
318
318
myitem. visibility. print_with_space( myitem. def_id, cx) ,
319
- anchor( myitem. def_id. expect_def_id( ) , * myitem. name. as_ref ( ) . unwrap( ) , cx) ,
319
+ anchor( myitem. def_id. expect_def_id( ) , myitem. name. unwrap( ) , cx) ,
320
320
) ,
321
321
}
322
322
w. write_str ( "</code></div>" ) ;
@@ -388,7 +388,7 @@ fn item_module(w: &mut Buffer, cx: &Context<'_>, item: &clean::Item, items: &[cl
388
388
{stab_tags}\
389
389
</div>\
390
390
<div class=\" item-right docblock-short\" >{docs}</div>",
391
- name = * myitem. name. as_ref ( ) . unwrap( ) ,
391
+ name = myitem. name. unwrap( ) ,
392
392
stab_tags = extra_info_tags( myitem, item, cx. tcx( ) ) ,
393
393
docs = MarkdownSummaryLine ( & doc_value, & myitem. links( cx) ) . into_string( ) ,
394
394
class = myitem. type_( ) ,
@@ -460,7 +460,7 @@ fn item_function(w: &mut Buffer, cx: &Context<'_>, it: &clean::Item, f: &clean::
460
460
let asyncness = f. header . asyncness . print_with_space ( ) ;
461
461
let unsafety = f. header . unsafety . print_with_space ( ) ;
462
462
let abi = print_abi_with_space ( f. header . abi ) . to_string ( ) ;
463
- let name = it. name . as_ref ( ) . unwrap ( ) ;
463
+ let name = it. name . unwrap ( ) ;
464
464
465
465
let generics_len = format ! ( "{:#}" , f. generics. print( cx) ) . len ( ) ;
466
466
let header_len = "fn " . len ( )
@@ -516,7 +516,7 @@ fn item_trait(w: &mut Buffer, cx: &Context<'_>, it: &clean::Item, t: &clean::Tra
516
516
it. visibility. print_with_space( it. def_id, cx) ,
517
517
t. unsafety. print_with_space( ) ,
518
518
if t. is_auto { "auto " } else { "" } ,
519
- it. name. as_ref ( ) . unwrap( ) ,
519
+ it. name. unwrap( ) ,
520
520
t. generics. print( cx) ,
521
521
bounds
522
522
) ;
@@ -657,7 +657,7 @@ fn item_trait(w: &mut Buffer, cx: &Context<'_>, it: &clean::Item, t: &clean::Tra
657
657
}
658
658
659
659
fn trait_item ( w : & mut Buffer , cx : & Context < ' _ > , m : & clean:: Item , t : & clean:: Item ) {
660
- let name = m. name . as_ref ( ) . unwrap ( ) ;
660
+ let name = m. name . unwrap ( ) ;
661
661
info ! ( "Documenting {} on {:?}" , name, t. name) ;
662
662
let item_type = m. type_ ( ) ;
663
663
let id = cx. derive_id ( format ! ( "{}.{}" , item_type, name) ) ;
@@ -867,7 +867,7 @@ fn item_trait(w: &mut Buffer, cx: &Context<'_>, it: &clean::Item, t: &clean::Tra
867
867
join_with_slash( None , & path[ ..path. len( ) - 1 ] )
868
868
} ,
869
869
ty = it. type_( ) ,
870
- name = * it. name. as_ref ( ) . unwrap( )
870
+ name = it. name. unwrap( )
871
871
) ;
872
872
}
873
873
@@ -878,7 +878,7 @@ fn item_trait_alias(w: &mut Buffer, cx: &Context<'_>, it: &clean::Item, t: &clea
878
878
write ! (
879
879
w,
880
880
"trait {}{}{} = {};" ,
881
- it. name. as_ref ( ) . unwrap( ) ,
881
+ it. name. unwrap( ) ,
882
882
t. generics. print( cx) ,
883
883
print_where_clause( & t. generics, cx, 0 , true ) ,
884
884
bounds( & t. bounds, true , cx)
@@ -902,7 +902,7 @@ fn item_opaque_ty(w: &mut Buffer, cx: &Context<'_>, it: &clean::Item, t: &clean:
902
902
write ! (
903
903
w,
904
904
"type {}{}{where_clause} = impl {bounds};" ,
905
- it. name. as_ref ( ) . unwrap( ) ,
905
+ it. name. unwrap( ) ,
906
906
t. generics. print( cx) ,
907
907
where_clause = print_where_clause( & t. generics, cx, 0 , true ) ,
908
908
bounds = bounds( & t. bounds, false , cx) ,
@@ -941,7 +941,7 @@ fn item_typedef(
941
941
write ! (
942
942
w,
943
943
"type {}{}{where_clause} = {type_};" ,
944
- it. name. as_ref ( ) . unwrap( ) ,
944
+ it. name. unwrap( ) ,
945
945
t. generics. print( cx) ,
946
946
where_clause = print_where_clause( & t. generics, cx, 0 , true ) ,
947
947
type_ = t. type_. print( cx) ,
@@ -994,7 +994,7 @@ fn item_union(w: &mut Buffer, cx: &Context<'_>, it: &clean::Item, s: &clean::Uni
994
994
Fields<a href=\" #fields\" class=\" anchor\" ></a></h2>"
995
995
) ;
996
996
for ( field, ty) in fields {
997
- let name = field. name . as_ref ( ) . expect ( "union field name" ) ;
997
+ let name = field. name . expect ( "union field name" ) ;
998
998
let id = format ! ( "{}.{}" , ItemType :: StructField , name) ;
999
999
write ! (
1000
1000
w,
@@ -1039,7 +1039,7 @@ fn item_enum(w: &mut Buffer, cx: &Context<'_>, it: &clean::Item, e: &clean::Enum
1039
1039
w,
1040
1040
"{}enum {}{}{}" ,
1041
1041
it. visibility. print_with_space( it. def_id, cx) ,
1042
- it. name. as_ref ( ) . unwrap( ) ,
1042
+ it. name. unwrap( ) ,
1043
1043
e. generics. print( cx) ,
1044
1044
print_where_clause( & e. generics, cx, 0 , true ) ,
1045
1045
) ;
@@ -1054,7 +1054,7 @@ fn item_enum(w: &mut Buffer, cx: &Context<'_>, it: &clean::Item, e: &clean::Enum
1054
1054
}
1055
1055
for v in & e. variants {
1056
1056
w. write_str ( " " ) ;
1057
- let name = v. name . as_ref ( ) . unwrap ( ) ;
1057
+ let name = v. name . unwrap ( ) ;
1058
1058
match * v. kind {
1059
1059
clean:: VariantItem ( ref var) => match var {
1060
1060
clean:: Variant :: CLike => write ! ( w, "{}" , name) ,
@@ -1103,15 +1103,14 @@ fn item_enum(w: &mut Buffer, cx: &Context<'_>, it: &clean::Item, e: &clean::Enum
1103
1103
) ;
1104
1104
document_non_exhaustive ( w, it) ;
1105
1105
for variant in & e. variants {
1106
- let id =
1107
- cx. derive_id ( format ! ( "{}.{}" , ItemType :: Variant , variant. name. as_ref( ) . unwrap( ) ) ) ;
1106
+ let id = cx. derive_id ( format ! ( "{}.{}" , ItemType :: Variant , variant. name. unwrap( ) ) ) ;
1108
1107
write ! (
1109
1108
w,
1110
1109
"<h3 id=\" {id}\" class=\" variant small-section-header\" >\
1111
1110
<a href=\" #{id}\" class=\" anchor field\" ></a>\
1112
1111
<code>{name}",
1113
1112
id = id,
1114
- name = variant. name. as_ref ( ) . unwrap( )
1113
+ name = variant. name. unwrap( )
1115
1114
) ;
1116
1115
if let clean:: VariantItem ( clean:: Variant :: Tuple ( ref s) ) = * variant. kind {
1117
1116
w. write_str ( "(" ) ;
@@ -1137,11 +1136,8 @@ fn item_enum(w: &mut Buffer, cx: &Context<'_>, it: &clean::Item, e: &clean::Enum
1137
1136
} ;
1138
1137
1139
1138
if let Some ( ( heading, fields) ) = heading_and_fields {
1140
- let variant_id = cx. derive_id ( format ! (
1141
- "{}.{}.fields" ,
1142
- ItemType :: Variant ,
1143
- variant. name. as_ref( ) . unwrap( )
1144
- ) ) ;
1139
+ let variant_id =
1140
+ cx. derive_id ( format ! ( "{}.{}.fields" , ItemType :: Variant , variant. name. unwrap( ) ) ) ;
1145
1141
write ! ( w, "<div class=\" sub-variant\" id=\" {id}\" >" , id = variant_id) ;
1146
1142
write ! ( w, "<h4>{heading}</h4>" , heading = heading) ;
1147
1143
document_non_exhaustive ( w, variant) ;
@@ -1151,8 +1147,8 @@ fn item_enum(w: &mut Buffer, cx: &Context<'_>, it: &clean::Item, e: &clean::Enum
1151
1147
clean:: StructFieldItem ( ref ty) => {
1152
1148
let id = cx. derive_id ( format ! (
1153
1149
"variant.{}.field.{}" ,
1154
- variant. name. as_ref ( ) . unwrap( ) ,
1155
- field. name. as_ref ( ) . unwrap( )
1150
+ variant. name. unwrap( ) ,
1151
+ field. name. unwrap( )
1156
1152
) ) ;
1157
1153
write ! (
1158
1154
w,
@@ -1162,7 +1158,7 @@ fn item_enum(w: &mut Buffer, cx: &Context<'_>, it: &clean::Item, e: &clean::Enum
1162
1158
<code>{f}: {t}</code>\
1163
1159
</span>",
1164
1160
id = id,
1165
- f = field. name. as_ref ( ) . unwrap( ) ,
1161
+ f = field. name. unwrap( ) ,
1166
1162
t = ty. print( cx)
1167
1163
) ;
1168
1164
document ( w, cx, field, Some ( variant) , HeadingOffset :: H5 ) ;
@@ -1201,7 +1197,7 @@ fn item_macro(w: &mut Buffer, cx: &Context<'_>, it: &clean::Item, t: &clean::Mac
1201
1197
1202
1198
fn item_proc_macro ( w : & mut Buffer , cx : & Context < ' _ > , it : & clean:: Item , m : & clean:: ProcMacro ) {
1203
1199
wrap_into_docblock ( w, |w| {
1204
- let name = it. name . as_ref ( ) . expect ( "proc-macros always have names" ) ;
1200
+ let name = it. name . expect ( "proc-macros always have names" ) ;
1205
1201
match m. kind {
1206
1202
MacroKind :: Bang => {
1207
1203
wrap_item ( w, "macro" , |w| {
@@ -1245,7 +1241,7 @@ fn item_constant(w: &mut Buffer, cx: &Context<'_>, it: &clean::Item, c: &clean::
1245
1241
w,
1246
1242
"{vis}const {name}: {typ}" ,
1247
1243
vis = it. visibility. print_with_space( it. def_id, cx) ,
1248
- name = it. name. as_ref ( ) . unwrap( ) ,
1244
+ name = it. name. unwrap( ) ,
1249
1245
typ = c. type_. print( cx) ,
1250
1246
) ;
1251
1247
@@ -1338,7 +1334,7 @@ fn item_static(w: &mut Buffer, cx: &Context<'_>, it: &clean::Item, s: &clean::St
1338
1334
"{vis}static {mutability}{name}: {typ}" ,
1339
1335
vis = it. visibility. print_with_space( it. def_id, cx) ,
1340
1336
mutability = s. mutability. print_with_space( ) ,
1341
- name = it. name. as_ref ( ) . unwrap( ) ,
1337
+ name = it. name. unwrap( ) ,
1342
1338
typ = s. type_. print( cx)
1343
1339
) ;
1344
1340
} ) ;
@@ -1355,7 +1351,7 @@ fn item_foreign_type(w: &mut Buffer, cx: &Context<'_>, it: &clean::Item) {
1355
1351
w,
1356
1352
" {}type {};\n }}" ,
1357
1353
it. visibility. print_with_space( it. def_id, cx) ,
1358
- it. name. as_ref ( ) . unwrap( ) ,
1354
+ it. name. unwrap( ) ,
1359
1355
) ;
1360
1356
} ) ;
1361
1357
} ) ;
@@ -1523,12 +1519,7 @@ fn render_union(
1523
1519
tab : & str ,
1524
1520
cx : & Context < ' _ > ,
1525
1521
) {
1526
- write ! (
1527
- w,
1528
- "{}union {}" ,
1529
- it. visibility. print_with_space( it. def_id, cx) ,
1530
- it. name. as_ref( ) . unwrap( )
1531
- ) ;
1522
+ write ! ( w, "{}union {}" , it. visibility. print_with_space( it. def_id, cx) , it. name. unwrap( ) ) ;
1532
1523
if let Some ( g) = g {
1533
1524
write ! ( w, "{}" , g. print( cx) ) ;
1534
1525
write ! ( w, "{}" , print_where_clause( g, cx, 0 , true ) ) ;
@@ -1548,7 +1539,7 @@ fn render_union(
1548
1539
w,
1549
1540
" {}{}: {},\n {}" ,
1550
1541
field. visibility. print_with_space( field. def_id, cx) ,
1551
- field. name. as_ref ( ) . unwrap( ) ,
1542
+ field. name. unwrap( ) ,
1552
1543
ty. print( cx) ,
1553
1544
tab
1554
1545
) ;
@@ -1579,7 +1570,7 @@ fn render_struct(
1579
1570
"{}{}{}" ,
1580
1571
it. visibility. print_with_space( it. def_id, cx) ,
1581
1572
if structhead { "struct " } else { "" } ,
1582
- it. name. as_ref ( ) . unwrap( )
1573
+ it. name. unwrap( )
1583
1574
) ;
1584
1575
if let Some ( g) = g {
1585
1576
write ! ( w, "{}" , g. print( cx) )
@@ -1604,7 +1595,7 @@ fn render_struct(
1604
1595
"\n {} {}{}: {}," ,
1605
1596
tab,
1606
1597
field. visibility. print_with_space( field. def_id, cx) ,
1607
- field. name. as_ref ( ) . unwrap( ) ,
1598
+ field. name. unwrap( ) ,
1608
1599
ty. print( cx) ,
1609
1600
) ;
1610
1601
}
0 commit comments