@@ -86,7 +86,7 @@ pub fn load_index(data: &[u8]) -> index::Index {
86
86
87
87
pub fn crate_rustc_version ( data : & [ u8 ] ) -> Option < String > {
88
88
let doc = rbml:: Doc :: new ( data) ;
89
- reader:: maybe_get_doc ( doc, tag_rustc_version) . map ( |s| s. as_str ( ) )
89
+ reader:: maybe_get_doc ( doc, tag_rustc_version) . map ( |s| s. to_string ( ) )
90
90
}
91
91
92
92
pub fn load_xrefs ( data : & [ u8 ] ) -> index:: DenseIndex {
@@ -207,7 +207,7 @@ fn item_defaultness(item: rbml::Doc) -> hir::Defaultness {
207
207
208
208
fn item_sort ( item : rbml:: Doc ) -> Option < char > {
209
209
reader:: tagged_docs ( item, tag_item_trait_item_sort) . nth ( 0 ) . map ( |doc| {
210
- doc. as_str_slice ( ) . as_bytes ( ) [ 0 ] as char
210
+ doc. as_str ( ) . as_bytes ( ) [ 0 ] as char
211
211
} )
212
212
}
213
213
@@ -282,7 +282,7 @@ fn item_name(item: rbml::Doc) -> ast::Name {
282
282
283
283
fn maybe_item_name ( item : rbml:: Doc ) -> Option < ast:: Name > {
284
284
reader:: maybe_get_doc ( item, tag_paths_data_name) . map ( |name| {
285
- let string = name. as_str_slice ( ) ;
285
+ let string = name. as_str ( ) ;
286
286
token:: intern ( string)
287
287
} )
288
288
}
@@ -368,7 +368,7 @@ fn parse_polarity(item_doc: rbml::Doc) -> hir::ImplPolarity {
368
368
fn parse_associated_type_names ( item_doc : rbml:: Doc ) -> Vec < ast:: Name > {
369
369
let names_doc = reader:: get_doc ( item_doc, tag_associated_type_names) ;
370
370
reader:: tagged_docs ( names_doc, tag_associated_type_name)
371
- . map ( |name_doc| token:: intern ( name_doc. as_str_slice ( ) ) )
371
+ . map ( |name_doc| token:: intern ( name_doc. as_str ( ) ) )
372
372
. collect ( )
373
373
}
374
374
@@ -682,7 +682,7 @@ fn each_child_of_item_or_crate<F, G>(cdata: Cmd,
682
682
683
683
let name_doc = reader:: get_doc ( reexport_doc,
684
684
tag_items_data_item_reexport_name) ;
685
- let name = name_doc. as_str_slice ( ) ;
685
+ let name = name_doc. as_str ( ) ;
686
686
687
687
// This reexport may be in yet another crate.
688
688
let crate_data = if child_def_id. krate == cdata. cnum {
@@ -869,7 +869,7 @@ fn get_explicit_self(item: rbml::Doc) -> ty::ExplicitSelfCategory {
869
869
}
870
870
871
871
let explicit_self_doc = reader:: get_doc ( item, tag_item_trait_method_explicit_self) ;
872
- let string = explicit_self_doc. as_str_slice ( ) ;
872
+ let string = explicit_self_doc. as_str ( ) ;
873
873
874
874
let explicit_self_kind = string. as_bytes ( ) [ 0 ] ;
875
875
match explicit_self_kind as char {
@@ -1124,19 +1124,19 @@ pub fn get_struct_field_names(cdata: Cmd, id: DefIndex) -> Vec<ast::Name> {
1124
1124
fn get_meta_items ( md : rbml:: Doc ) -> Vec < P < ast:: MetaItem > > {
1125
1125
reader:: tagged_docs ( md, tag_meta_item_word) . map ( |meta_item_doc| {
1126
1126
let nd = reader:: get_doc ( meta_item_doc, tag_meta_item_name) ;
1127
- let n = token:: intern_and_get_ident ( nd. as_str_slice ( ) ) ;
1127
+ let n = token:: intern_and_get_ident ( nd. as_str ( ) ) ;
1128
1128
attr:: mk_word_item ( n)
1129
1129
} ) . chain ( reader:: tagged_docs ( md, tag_meta_item_name_value) . map ( |meta_item_doc| {
1130
1130
let nd = reader:: get_doc ( meta_item_doc, tag_meta_item_name) ;
1131
1131
let vd = reader:: get_doc ( meta_item_doc, tag_meta_item_value) ;
1132
- let n = token:: intern_and_get_ident ( nd. as_str_slice ( ) ) ;
1133
- let v = token:: intern_and_get_ident ( vd. as_str_slice ( ) ) ;
1132
+ let n = token:: intern_and_get_ident ( nd. as_str ( ) ) ;
1133
+ let v = token:: intern_and_get_ident ( vd. as_str ( ) ) ;
1134
1134
// FIXME (#623): Should be able to decode MetaItemKind::NameValue variants,
1135
1135
// but currently the encoder just drops them
1136
1136
attr:: mk_name_value_item_str ( n, v)
1137
1137
} ) ) . chain ( reader:: tagged_docs ( md, tag_meta_item_list) . map ( |meta_item_doc| {
1138
1138
let nd = reader:: get_doc ( meta_item_doc, tag_meta_item_name) ;
1139
- let n = token:: intern_and_get_ident ( nd. as_str_slice ( ) ) ;
1139
+ let n = token:: intern_and_get_ident ( nd. as_str ( ) ) ;
1140
1140
let subitems = get_meta_items ( meta_item_doc) ;
1141
1141
attr:: mk_list_item ( n, subitems)
1142
1142
} ) ) . collect ( )
@@ -1191,7 +1191,7 @@ pub fn get_crate_deps(data: &[u8]) -> Vec<CrateDep> {
1191
1191
1192
1192
fn docstr ( doc : rbml:: Doc , tag_ : usize ) -> String {
1193
1193
let d = reader:: get_doc ( doc, tag_) ;
1194
- d. as_str_slice ( ) . to_string ( )
1194
+ d. as_str ( ) . to_string ( )
1195
1195
}
1196
1196
1197
1197
reader:: tagged_docs ( depsdoc, tag_crate_dep) . enumerate ( ) . map ( |( crate_num, depdoc) | {
@@ -1233,14 +1233,14 @@ pub fn get_crate_hash(data: &[u8]) -> Svh {
1233
1233
pub fn maybe_get_crate_name ( data : & [ u8 ] ) -> Option < & str > {
1234
1234
let cratedoc = rbml:: Doc :: new ( data) ;
1235
1235
reader:: maybe_get_doc ( cratedoc, tag_crate_crate_name) . map ( |doc| {
1236
- doc. as_str_slice ( )
1236
+ doc. as_str ( )
1237
1237
} )
1238
1238
}
1239
1239
1240
1240
pub fn get_crate_disambiguator < ' a > ( data : & ' a [ u8 ] ) -> & ' a str {
1241
1241
let crate_doc = rbml:: Doc :: new ( data) ;
1242
1242
let disambiguator_doc = reader:: get_doc ( crate_doc, tag_crate_disambiguator) ;
1243
- let slice: & ' a str = disambiguator_doc. as_str_slice ( ) ;
1243
+ let slice: & ' a str = disambiguator_doc. as_str ( ) ;
1244
1244
slice
1245
1245
}
1246
1246
@@ -1446,11 +1446,12 @@ pub fn get_dylib_dependency_formats(cdata: Cmd)
1446
1446
tag_dylib_dependency_formats) ;
1447
1447
let mut result = Vec :: new ( ) ;
1448
1448
1449
- debug ! ( "found dylib deps: {}" , formats. as_str_slice ( ) ) ;
1450
- for spec in formats. as_str_slice ( ) . split ( ',' ) {
1449
+ debug ! ( "found dylib deps: {}" , formats. as_str ( ) ) ;
1450
+ for spec in formats. as_str ( ) . split ( ',' ) {
1451
1451
if spec. is_empty ( ) { continue }
1452
- let cnum = spec. split ( ':' ) . nth ( 0 ) . unwrap ( ) ;
1453
- let link = spec. split ( ':' ) . nth ( 1 ) . unwrap ( ) ;
1452
+ let mut split = spec. split ( ':' ) ;
1453
+ let cnum = split. next ( ) . unwrap ( ) ;
1454
+ let link = split. next ( ) . unwrap ( ) ;
1454
1455
let cnum: ast:: CrateNum = cnum. parse ( ) . unwrap ( ) ;
1455
1456
let cnum = cdata. cnum_map . borrow ( ) [ cnum] ;
1456
1457
result. push ( ( cnum, if link == "d" {
@@ -1476,7 +1477,7 @@ pub fn get_method_arg_names(cdata: Cmd, id: DefIndex) -> Vec<String> {
1476
1477
match reader:: maybe_get_doc ( method_doc, tag_method_argument_names) {
1477
1478
Some ( args_doc) => {
1478
1479
reader:: tagged_docs ( args_doc, tag_method_argument_name) . map ( |name_doc| {
1479
- name_doc. as_str_slice ( ) . to_string ( )
1480
+ name_doc. as_str ( ) . to_string ( )
1480
1481
} ) . collect ( )
1481
1482
} ,
1482
1483
None => vec ! [ ] ,
@@ -1641,7 +1642,7 @@ fn item_def_key(item_doc: rbml::Doc) -> hir_map::DefKey {
1641
1642
let mut decoder = reader:: Decoder :: new ( def_key_doc) ;
1642
1643
let simple_key = def_key:: DefKey :: decode ( & mut decoder) . unwrap ( ) ;
1643
1644
let name = reader:: maybe_get_doc ( item_doc, tag_paths_data_name) . map ( |name| {
1644
- token:: intern ( name. as_str_slice ( ) ) . as_str ( )
1645
+ token:: intern ( name. as_str ( ) ) . as_str ( )
1645
1646
} ) ;
1646
1647
def_key:: recover_def_key ( simple_key, name)
1647
1648
}
0 commit comments