@@ -40,7 +40,6 @@ use syntax::attr;
4040use syntax:: attr:: AttrMetaMethods ;
4141use syntax:: diagnostic:: SpanHandler ;
4242use syntax:: parse:: token:: special_idents;
43- use syntax:: parse:: token;
4443use syntax:: print:: pprust;
4544use syntax:: ptr:: P ;
4645use syntax:: visit:: Visitor ;
@@ -83,11 +82,11 @@ pub struct EncodeContext<'a, 'tcx: 'a> {
8382}
8483
8584fn encode_name ( rbml_w : & mut Encoder , name : ast:: Name ) {
86- rbml_w. wr_tagged_str ( tag_paths_data_name, & token :: get_name ( name) ) ;
85+ rbml_w. wr_tagged_str ( tag_paths_data_name, & name. as_str ( ) ) ;
8786}
8887
8988fn encode_impl_type_basename ( rbml_w : & mut Encoder , name : ast:: Name ) {
90- rbml_w. wr_tagged_str ( tag_item_impl_type_basename, & token :: get_name ( name) ) ;
89+ rbml_w. wr_tagged_str ( tag_item_impl_type_basename, & name. as_str ( ) ) ;
9190}
9291
9392fn encode_def_id ( rbml_w : & mut Encoder , id : DefId ) {
@@ -349,7 +348,7 @@ fn encode_path<PI: Iterator<Item=PathElem>>(rbml_w: &mut Encoder, path: PI) {
349348 ast_map:: PathMod ( _) => tag_path_elem_mod,
350349 ast_map:: PathName ( _) => tag_path_elem_name
351350 } ;
352- rbml_w. wr_tagged_str ( tag, & token :: get_name ( pe. name ( ) ) ) ;
351+ rbml_w. wr_tagged_str ( tag, & pe. name ( ) . as_str ( ) ) ;
353352 }
354353 rbml_w. end_tag ( ) ;
355354}
@@ -359,13 +358,13 @@ fn encode_reexported_static_method(rbml_w: &mut Encoder,
359358 method_def_id : DefId ,
360359 method_name : ast:: Name ) {
361360 debug ! ( "(encode reexported static method) {}::{}" ,
362- exp. name, token :: get_name ( method_name) ) ;
361+ exp. name, method_name) ;
363362 rbml_w. start_tag ( tag_items_data_item_reexport) ;
364363 rbml_w. wr_tagged_u64 ( tag_items_data_item_reexport_def_id,
365364 def_to_u64 ( method_def_id) ) ;
366365 rbml_w. wr_tagged_str ( tag_items_data_item_reexport_name,
367366 & format ! ( "{}::{}" , exp. name,
368- token :: get_name ( method_name) ) ) ;
367+ method_name) ) ;
369368 rbml_w. end_tag ( ) ;
370369}
371370
@@ -499,15 +498,12 @@ fn encode_reexports(ecx: &EncodeContext,
499498 rbml_w. wr_tagged_u64 ( tag_items_data_item_reexport_def_id,
500499 def_to_u64 ( exp. def_id ) ) ;
501500 rbml_w. wr_tagged_str ( tag_items_data_item_reexport_name,
502- exp. name . as_str ( ) ) ;
501+ & exp. name . as_str ( ) ) ;
503502 rbml_w. end_tag ( ) ;
504503 encode_reexported_static_methods ( ecx, rbml_w, path. clone ( ) , exp) ;
505504 }
506- }
507- None => {
508- debug ! ( "(encoding info for module) found no reexports for {}" ,
509- id) ;
510- }
505+ } ,
506+ None => debug ! ( "(encoding info for module) found no reexports for {}" , id) ,
511507 }
512508}
513509
@@ -539,7 +535,7 @@ fn encode_info_for_mod(ecx: &EncodeContext,
539535 if let ast:: ItemImpl ( ..) = item. node {
540536 let ( ident, did) = ( item. ident , item. id ) ;
541537 debug ! ( "(encoding info for module) ... encoding impl {} ({}/{})" ,
542- token :: get_ident ( ident) ,
538+ ident,
543539 did, ecx. tcx. map. node_to_string( did) ) ;
544540
545541 rbml_w. wr_tagged_u64 ( tag_mod_impl, def_to_u64 ( local_def ( did) ) ) ;
@@ -656,7 +652,7 @@ fn encode_info_for_struct(ecx: &EncodeContext,
656652 } ) ;
657653 rbml_w. start_tag ( tag_items_data_item) ;
658654 debug ! ( "encode_info_for_struct: doing {} {}" ,
659- token :: get_name ( nm ) , id) ;
655+ nm , id) ;
660656 encode_struct_field_family ( rbml_w, field. vis ) ;
661657 encode_name ( rbml_w, nm) ;
662658 encode_bounds_and_type_for_item ( rbml_w, ecx, id) ;
@@ -816,7 +812,7 @@ fn encode_info_for_associated_const(ecx: &EncodeContext,
816812 impl_item_opt : Option < & ast:: ImplItem > ) {
817813 debug ! ( "encode_info_for_associated_const({:?},{:?})" ,
818814 associated_const. def_id,
819- token :: get_name ( associated_const. name) ) ;
815+ associated_const. name) ;
820816
821817 rbml_w. start_tag ( tag_items_data_item) ;
822818
@@ -854,7 +850,7 @@ fn encode_info_for_method<'a, 'tcx>(ecx: &EncodeContext<'a, 'tcx>,
854850 impl_item_opt : Option < & ast:: ImplItem > ) {
855851
856852 debug ! ( "encode_info_for_method: {:?} {:?}" , m. def_id,
857- token :: get_name ( m. name) ) ;
853+ m. name) ;
858854 rbml_w. start_tag ( tag_items_data_item) ;
859855
860856 encode_method_ty_fields ( ecx, rbml_w, m) ;
@@ -899,7 +895,7 @@ fn encode_info_for_associated_type<'a, 'tcx>(ecx: &EncodeContext<'a, 'tcx>,
899895 impl_item_opt : Option < & ast:: ImplItem > ) {
900896 debug ! ( "encode_info_for_associated_type({:?},{:?})" ,
901897 associated_type. def_id,
902- token :: get_name ( associated_type. name) ) ;
898+ associated_type. name) ;
903899
904900 rbml_w. start_tag ( tag_items_data_item) ;
905901
@@ -937,7 +933,7 @@ fn encode_method_argument_names(rbml_w: &mut Encoder,
937933 for arg in & decl. inputs {
938934 let tag = tag_method_argument_name;
939935 if let ast:: PatIdent ( _, ref path1, _) = arg. pat . node {
940- let name = token :: get_name ( path1. node . name ) ;
936+ let name = path1. node . name . as_str ( ) ;
941937 rbml_w. wr_tagged_bytes ( tag, name. as_bytes ( ) ) ;
942938 } else {
943939 rbml_w. wr_tagged_bytes ( tag, & [ ] ) ;
@@ -1562,7 +1558,7 @@ fn my_visit_foreign_item(ni: &ast::ForeignItem,
15621558 index : & mut Vec < entry < i64 > > ) {
15631559 debug ! ( "writing foreign item {}::{}" ,
15641560 ecx. tcx. map. path_to_string( ni. id) ,
1565- token :: get_ident ( ni. ident) ) ;
1561+ ni. ident) ;
15661562
15671563 let abi = ecx. tcx . map . get_foreign_abi ( ni. id ) ;
15681564 ecx. tcx . map . with_path ( ni. id , |path| {
@@ -1748,7 +1744,7 @@ fn encode_defaulted(rbml_w: &mut Encoder, is_defaulted: bool) {
17481744fn encode_associated_type_names ( rbml_w : & mut Encoder , names : & [ ast:: Name ] ) {
17491745 rbml_w. start_tag ( tag_associated_type_names) ;
17501746 for & name in names {
1751- rbml_w. wr_tagged_str ( tag_associated_type_name, & token :: get_name ( name) ) ;
1747+ rbml_w. wr_tagged_str ( tag_associated_type_name, & name. as_str ( ) ) ;
17521748 }
17531749 rbml_w. end_tag ( ) ;
17541750}
0 commit comments