@@ -86,7 +86,7 @@ pub fn load_index(data: &[u8]) -> index::Index {
8686
8787pub fn crate_rustc_version ( data : & [ u8 ] ) -> Option < String > {
8888 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 ( ) )
9090}
9191
9292pub fn load_xrefs ( data : & [ u8 ] ) -> index:: DenseIndex {
@@ -207,7 +207,7 @@ fn item_defaultness(item: rbml::Doc) -> hir::Defaultness {
207207
208208fn item_sort ( item : rbml:: Doc ) -> Option < char > {
209209 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
211211 } )
212212}
213213
@@ -282,7 +282,7 @@ fn item_name(item: rbml::Doc) -> ast::Name {
282282
283283fn maybe_item_name ( item : rbml:: Doc ) -> Option < ast:: Name > {
284284 reader:: maybe_get_doc ( item, tag_paths_data_name) . map ( |name| {
285- let string = name. as_str_slice ( ) ;
285+ let string = name. as_str ( ) ;
286286 token:: intern ( string)
287287 } )
288288}
@@ -368,7 +368,7 @@ fn parse_polarity(item_doc: rbml::Doc) -> hir::ImplPolarity {
368368fn parse_associated_type_names ( item_doc : rbml:: Doc ) -> Vec < ast:: Name > {
369369 let names_doc = reader:: get_doc ( item_doc, tag_associated_type_names) ;
370370 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 ( ) ) )
372372 . collect ( )
373373}
374374
@@ -682,7 +682,7 @@ fn each_child_of_item_or_crate<F, G>(cdata: Cmd,
682682
683683 let name_doc = reader:: get_doc ( reexport_doc,
684684 tag_items_data_item_reexport_name) ;
685- let name = name_doc. as_str_slice ( ) ;
685+ let name = name_doc. as_str ( ) ;
686686
687687 // This reexport may be in yet another crate.
688688 let crate_data = if child_def_id. krate == cdata. cnum {
@@ -869,7 +869,7 @@ fn get_explicit_self(item: rbml::Doc) -> ty::ExplicitSelfCategory {
869869 }
870870
871871 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 ( ) ;
873873
874874 let explicit_self_kind = string. as_bytes ( ) [ 0 ] ;
875875 match explicit_self_kind as char {
@@ -1124,19 +1124,19 @@ pub fn get_struct_field_names(cdata: Cmd, id: DefIndex) -> Vec<ast::Name> {
11241124fn get_meta_items ( md : rbml:: Doc ) -> Vec < P < ast:: MetaItem > > {
11251125 reader:: tagged_docs ( md, tag_meta_item_word) . map ( |meta_item_doc| {
11261126 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 ( ) ) ;
11281128 attr:: mk_word_item ( n)
11291129 } ) . chain ( reader:: tagged_docs ( md, tag_meta_item_name_value) . map ( |meta_item_doc| {
11301130 let nd = reader:: get_doc ( meta_item_doc, tag_meta_item_name) ;
11311131 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 ( ) ) ;
11341134 // FIXME (#623): Should be able to decode MetaItemKind::NameValue variants,
11351135 // but currently the encoder just drops them
11361136 attr:: mk_name_value_item_str ( n, v)
11371137 } ) ) . chain ( reader:: tagged_docs ( md, tag_meta_item_list) . map ( |meta_item_doc| {
11381138 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 ( ) ) ;
11401140 let subitems = get_meta_items ( meta_item_doc) ;
11411141 attr:: mk_list_item ( n, subitems)
11421142 } ) ) . collect ( )
@@ -1191,7 +1191,7 @@ pub fn get_crate_deps(data: &[u8]) -> Vec<CrateDep> {
11911191
11921192 fn docstr ( doc : rbml:: Doc , tag_ : usize ) -> String {
11931193 let d = reader:: get_doc ( doc, tag_) ;
1194- d. as_str_slice ( ) . to_string ( )
1194+ d. as_str ( ) . to_string ( )
11951195 }
11961196
11971197 reader:: tagged_docs ( depsdoc, tag_crate_dep) . enumerate ( ) . map ( |( crate_num, depdoc) | {
@@ -1233,14 +1233,14 @@ pub fn get_crate_hash(data: &[u8]) -> Svh {
12331233pub fn maybe_get_crate_name ( data : & [ u8 ] ) -> Option < & str > {
12341234 let cratedoc = rbml:: Doc :: new ( data) ;
12351235 reader:: maybe_get_doc ( cratedoc, tag_crate_crate_name) . map ( |doc| {
1236- doc. as_str_slice ( )
1236+ doc. as_str ( )
12371237 } )
12381238}
12391239
12401240pub fn get_crate_disambiguator < ' a > ( data : & ' a [ u8 ] ) -> & ' a str {
12411241 let crate_doc = rbml:: Doc :: new ( data) ;
12421242 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 ( ) ;
12441244 slice
12451245}
12461246
@@ -1446,11 +1446,12 @@ pub fn get_dylib_dependency_formats(cdata: Cmd)
14461446 tag_dylib_dependency_formats) ;
14471447 let mut result = Vec :: new ( ) ;
14481448
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 ( ',' ) {
14511451 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 ( ) ;
14541455 let cnum: ast:: CrateNum = cnum. parse ( ) . unwrap ( ) ;
14551456 let cnum = cdata. cnum_map . borrow ( ) [ cnum] ;
14561457 result. push ( ( cnum, if link == "d" {
@@ -1476,7 +1477,7 @@ pub fn get_method_arg_names(cdata: Cmd, id: DefIndex) -> Vec<String> {
14761477 match reader:: maybe_get_doc ( method_doc, tag_method_argument_names) {
14771478 Some ( args_doc) => {
14781479 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 ( )
14801481 } ) . collect ( )
14811482 } ,
14821483 None => vec ! [ ] ,
@@ -1641,7 +1642,7 @@ fn item_def_key(item_doc: rbml::Doc) -> hir_map::DefKey {
16411642 let mut decoder = reader:: Decoder :: new ( def_key_doc) ;
16421643 let simple_key = def_key:: DefKey :: decode ( & mut decoder) . unwrap ( ) ;
16431644 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 ( )
16451646 } ) ;
16461647 def_key:: recover_def_key ( simple_key, name)
16471648 }
0 commit comments