@@ -40,7 +40,6 @@ use syntax::attr;
40
40
use syntax:: attr:: AttrMetaMethods ;
41
41
use syntax:: diagnostic:: SpanHandler ;
42
42
use syntax:: parse:: token:: special_idents;
43
- use syntax:: parse:: token;
44
43
use syntax:: print:: pprust;
45
44
use syntax:: ptr:: P ;
46
45
use syntax:: visit:: Visitor ;
@@ -83,11 +82,11 @@ pub struct EncodeContext<'a, 'tcx: 'a> {
83
82
}
84
83
85
84
fn 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 ( ) ) ;
87
86
}
88
87
89
88
fn 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 ( ) ) ;
91
90
}
92
91
93
92
fn 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) {
349
348
ast_map:: PathMod ( _) => tag_path_elem_mod,
350
349
ast_map:: PathName ( _) => tag_path_elem_name
351
350
} ;
352
- rbml_w. wr_tagged_str ( tag, & token :: get_name ( pe. name ( ) ) ) ;
351
+ rbml_w. wr_tagged_str ( tag, & pe. name ( ) . as_str ( ) ) ;
353
352
}
354
353
rbml_w. end_tag ( ) ;
355
354
}
@@ -359,13 +358,13 @@ fn encode_reexported_static_method(rbml_w: &mut Encoder,
359
358
method_def_id : DefId ,
360
359
method_name : ast:: Name ) {
361
360
debug ! ( "(encode reexported static method) {}::{}" ,
362
- exp. name, token :: get_name ( method_name) ) ;
361
+ exp. name, method_name) ;
363
362
rbml_w. start_tag ( tag_items_data_item_reexport) ;
364
363
rbml_w. wr_tagged_u64 ( tag_items_data_item_reexport_def_id,
365
364
def_to_u64 ( method_def_id) ) ;
366
365
rbml_w. wr_tagged_str ( tag_items_data_item_reexport_name,
367
366
& format ! ( "{}::{}" , exp. name,
368
- token :: get_name ( method_name) ) ) ;
367
+ method_name) ) ;
369
368
rbml_w. end_tag ( ) ;
370
369
}
371
370
@@ -499,15 +498,12 @@ fn encode_reexports(ecx: &EncodeContext,
499
498
rbml_w. wr_tagged_u64 ( tag_items_data_item_reexport_def_id,
500
499
def_to_u64 ( exp. def_id ) ) ;
501
500
rbml_w. wr_tagged_str ( tag_items_data_item_reexport_name,
502
- exp. name . as_str ( ) ) ;
501
+ & exp. name . as_str ( ) ) ;
503
502
rbml_w. end_tag ( ) ;
504
503
encode_reexported_static_methods ( ecx, rbml_w, path. clone ( ) , exp) ;
505
504
}
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) ,
511
507
}
512
508
}
513
509
@@ -539,7 +535,7 @@ fn encode_info_for_mod(ecx: &EncodeContext,
539
535
if let ast:: ItemImpl ( ..) = item. node {
540
536
let ( ident, did) = ( item. ident , item. id ) ;
541
537
debug ! ( "(encoding info for module) ... encoding impl {} ({}/{})" ,
542
- token :: get_ident ( ident) ,
538
+ ident,
543
539
did, ecx. tcx. map. node_to_string( did) ) ;
544
540
545
541
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,
656
652
} ) ;
657
653
rbml_w. start_tag ( tag_items_data_item) ;
658
654
debug ! ( "encode_info_for_struct: doing {} {}" ,
659
- token :: get_name ( nm ) , id) ;
655
+ nm , id) ;
660
656
encode_struct_field_family ( rbml_w, field. vis ) ;
661
657
encode_name ( rbml_w, nm) ;
662
658
encode_bounds_and_type_for_item ( rbml_w, ecx, id) ;
@@ -816,7 +812,7 @@ fn encode_info_for_associated_const(ecx: &EncodeContext,
816
812
impl_item_opt : Option < & ast:: ImplItem > ) {
817
813
debug ! ( "encode_info_for_associated_const({:?},{:?})" ,
818
814
associated_const. def_id,
819
- token :: get_name ( associated_const. name) ) ;
815
+ associated_const. name) ;
820
816
821
817
rbml_w. start_tag ( tag_items_data_item) ;
822
818
@@ -854,7 +850,7 @@ fn encode_info_for_method<'a, 'tcx>(ecx: &EncodeContext<'a, 'tcx>,
854
850
impl_item_opt : Option < & ast:: ImplItem > ) {
855
851
856
852
debug ! ( "encode_info_for_method: {:?} {:?}" , m. def_id,
857
- token :: get_name ( m. name) ) ;
853
+ m. name) ;
858
854
rbml_w. start_tag ( tag_items_data_item) ;
859
855
860
856
encode_method_ty_fields ( ecx, rbml_w, m) ;
@@ -899,7 +895,7 @@ fn encode_info_for_associated_type<'a, 'tcx>(ecx: &EncodeContext<'a, 'tcx>,
899
895
impl_item_opt : Option < & ast:: ImplItem > ) {
900
896
debug ! ( "encode_info_for_associated_type({:?},{:?})" ,
901
897
associated_type. def_id,
902
- token :: get_name ( associated_type. name) ) ;
898
+ associated_type. name) ;
903
899
904
900
rbml_w. start_tag ( tag_items_data_item) ;
905
901
@@ -937,7 +933,7 @@ fn encode_method_argument_names(rbml_w: &mut Encoder,
937
933
for arg in & decl. inputs {
938
934
let tag = tag_method_argument_name;
939
935
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 ( ) ;
941
937
rbml_w. wr_tagged_bytes ( tag, name. as_bytes ( ) ) ;
942
938
} else {
943
939
rbml_w. wr_tagged_bytes ( tag, & [ ] ) ;
@@ -1562,7 +1558,7 @@ fn my_visit_foreign_item(ni: &ast::ForeignItem,
1562
1558
index : & mut Vec < entry < i64 > > ) {
1563
1559
debug ! ( "writing foreign item {}::{}" ,
1564
1560
ecx. tcx. map. path_to_string( ni. id) ,
1565
- token :: get_ident ( ni. ident) ) ;
1561
+ ni. ident) ;
1566
1562
1567
1563
let abi = ecx. tcx . map . get_foreign_abi ( ni. id ) ;
1568
1564
ecx. tcx . map . with_path ( ni. id , |path| {
@@ -1748,7 +1744,7 @@ fn encode_defaulted(rbml_w: &mut Encoder, is_defaulted: bool) {
1748
1744
fn encode_associated_type_names ( rbml_w : & mut Encoder , names : & [ ast:: Name ] ) {
1749
1745
rbml_w. start_tag ( tag_associated_type_names) ;
1750
1746
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 ( ) ) ;
1752
1748
}
1753
1749
rbml_w. end_tag ( ) ;
1754
1750
}
0 commit comments