@@ -262,7 +262,7 @@ impl<'a> State<'a> {
262
262
indented : usize ,
263
263
close_box : bool )
264
264
-> io:: Result < ( ) > {
265
- self . maybe_print_comment ( span. hi ) ?;
265
+ self . maybe_print_comment ( span. hi ( ) ) ?;
266
266
self . break_offset_if_not_bol ( 1 , -( indented as isize ) ) ?;
267
267
self . s . word ( "}" ) ?;
268
268
if close_box {
@@ -324,12 +324,12 @@ impl<'a> State<'a> {
324
324
let len = elts. len ( ) ;
325
325
let mut i = 0 ;
326
326
for elt in elts {
327
- self . maybe_print_comment ( get_span ( elt) . hi ) ?;
327
+ self . maybe_print_comment ( get_span ( elt) . hi ( ) ) ?;
328
328
op ( self , elt) ?;
329
329
i += 1 ;
330
330
if i < len {
331
331
self . s . word ( "," ) ?;
332
- self . maybe_print_trailing_comment ( get_span ( elt) , Some ( get_span ( & elts[ i] ) . hi ) ) ?;
332
+ self . maybe_print_trailing_comment ( get_span ( elt) , Some ( get_span ( & elts[ i] ) . hi ( ) ) ) ?;
333
333
self . space_if_not_bol ( ) ?;
334
334
}
335
335
}
@@ -368,7 +368,7 @@ impl<'a> State<'a> {
368
368
}
369
369
370
370
pub fn print_type ( & mut self , ty : & hir:: Ty ) -> io:: Result < ( ) > {
371
- self . maybe_print_comment ( ty. span . lo ) ?;
371
+ self . maybe_print_comment ( ty. span . lo ( ) ) ?;
372
372
self . ibox ( 0 ) ?;
373
373
match ty. node {
374
374
hir:: TySlice ( ref ty) => {
@@ -458,7 +458,7 @@ impl<'a> State<'a> {
458
458
459
459
pub fn print_foreign_item ( & mut self , item : & hir:: ForeignItem ) -> io:: Result < ( ) > {
460
460
self . hardbreak_if_not_bol ( ) ?;
461
- self . maybe_print_comment ( item. span . lo ) ?;
461
+ self . maybe_print_comment ( item. span . lo ( ) ) ?;
462
462
self . print_outer_attributes ( & item. attrs ) ?;
463
463
match item. node {
464
464
hir:: ForeignItemFn ( ref decl, ref arg_names, ref generics) => {
@@ -531,7 +531,7 @@ impl<'a> State<'a> {
531
531
/// Pretty-print an item
532
532
pub fn print_item ( & mut self , item : & hir:: Item ) -> io:: Result < ( ) > {
533
533
self . hardbreak_if_not_bol ( ) ?;
534
- self . maybe_print_comment ( item. span . lo ) ?;
534
+ self . maybe_print_comment ( item. span . lo ( ) ) ?;
535
535
self . print_outer_attributes ( & item. attrs ) ?;
536
536
self . ann . pre ( self , NodeItem ( item) ) ?;
537
537
match item. node {
@@ -797,7 +797,7 @@ impl<'a> State<'a> {
797
797
self . bopen ( ) ?;
798
798
for v in variants {
799
799
self . space_if_not_bol ( ) ?;
800
- self . maybe_print_comment ( v. span . lo ) ?;
800
+ self . maybe_print_comment ( v. span . lo ( ) ) ?;
801
801
self . print_outer_attributes ( & v. node . attrs ) ?;
802
802
self . ibox ( indent_unit) ?;
803
803
self . print_variant ( v) ?;
@@ -842,7 +842,7 @@ impl<'a> State<'a> {
842
842
if struct_def. is_tuple ( ) {
843
843
self . popen ( ) ?;
844
844
self . commasep ( Inconsistent , struct_def. fields ( ) , |s, field| {
845
- s. maybe_print_comment ( field. span . lo ) ?;
845
+ s. maybe_print_comment ( field. span . lo ( ) ) ?;
846
846
s. print_outer_attributes ( & field. attrs ) ?;
847
847
s. print_visibility ( & field. vis ) ?;
848
848
s. print_type ( & field. ty )
@@ -863,7 +863,7 @@ impl<'a> State<'a> {
863
863
864
864
for field in struct_def. fields ( ) {
865
865
self . hardbreak_if_not_bol ( ) ?;
866
- self . maybe_print_comment ( field. span . lo ) ?;
866
+ self . maybe_print_comment ( field. span . lo ( ) ) ?;
867
867
self . print_outer_attributes ( & field. attrs ) ?;
868
868
self . print_visibility ( & field. vis ) ?;
869
869
self . print_name ( field. name ) ?;
@@ -908,7 +908,7 @@ impl<'a> State<'a> {
908
908
pub fn print_trait_item ( & mut self , ti : & hir:: TraitItem ) -> io:: Result < ( ) > {
909
909
self . ann . pre ( self , NodeSubItem ( ti. id ) ) ?;
910
910
self . hardbreak_if_not_bol ( ) ?;
911
- self . maybe_print_comment ( ti. span . lo ) ?;
911
+ self . maybe_print_comment ( ti. span . lo ( ) ) ?;
912
912
self . print_outer_attributes ( & ti. attrs ) ?;
913
913
match ti. node {
914
914
hir:: TraitItemKind :: Const ( ref ty, default) => {
@@ -938,7 +938,7 @@ impl<'a> State<'a> {
938
938
pub fn print_impl_item ( & mut self , ii : & hir:: ImplItem ) -> io:: Result < ( ) > {
939
939
self . ann . pre ( self , NodeSubItem ( ii. id ) ) ?;
940
940
self . hardbreak_if_not_bol ( ) ?;
941
- self . maybe_print_comment ( ii. span . lo ) ?;
941
+ self . maybe_print_comment ( ii. span . lo ( ) ) ?;
942
942
self . print_outer_attributes ( & ii. attrs ) ?;
943
943
self . print_defaultness ( ii. defaultness ) ?;
944
944
@@ -962,7 +962,7 @@ impl<'a> State<'a> {
962
962
}
963
963
964
964
pub fn print_stmt ( & mut self , st : & hir:: Stmt ) -> io:: Result < ( ) > {
965
- self . maybe_print_comment ( st. span . lo ) ?;
965
+ self . maybe_print_comment ( st. span . lo ( ) ) ?;
966
966
match st. node {
967
967
hir:: StmtDecl ( ref decl, _) => {
968
968
self . print_decl ( & decl) ?;
@@ -1017,7 +1017,7 @@ impl<'a> State<'a> {
1017
1017
hir:: PopUnsafeBlock ( ..) => self . word_space ( "pop_unsafe" ) ?,
1018
1018
hir:: DefaultBlock => ( ) ,
1019
1019
}
1020
- self . maybe_print_comment ( blk. span . lo ) ?;
1020
+ self . maybe_print_comment ( blk. span . lo ( ) ) ?;
1021
1021
self . ann . pre ( self , NodeBlock ( blk) ) ?;
1022
1022
self . bopen ( ) ?;
1023
1023
@@ -1030,7 +1030,7 @@ impl<'a> State<'a> {
1030
1030
Some ( ref expr) => {
1031
1031
self . space_if_not_bol ( ) ?;
1032
1032
self . print_expr ( & expr) ?;
1033
- self . maybe_print_trailing_comment ( expr. span , Some ( blk. span . hi ) ) ?;
1033
+ self . maybe_print_trailing_comment ( expr. span , Some ( blk. span . hi ( ) ) ) ?;
1034
1034
}
1035
1035
_ => ( ) ,
1036
1036
}
@@ -1228,7 +1228,7 @@ impl<'a> State<'a> {
1228
1228
}
1229
1229
1230
1230
pub fn print_expr ( & mut self , expr : & hir:: Expr ) -> io:: Result < ( ) > {
1231
- self . maybe_print_comment ( expr. span . lo ) ?;
1231
+ self . maybe_print_comment ( expr. span . lo ( ) ) ?;
1232
1232
self . print_outer_attributes ( & expr. attrs ) ?;
1233
1233
self . ibox ( indent_unit) ?;
1234
1234
self . ann . pre ( self , NodeExpr ( expr) ) ?;
@@ -1480,7 +1480,7 @@ impl<'a> State<'a> {
1480
1480
}
1481
1481
1482
1482
pub fn print_decl ( & mut self , decl : & hir:: Decl ) -> io:: Result < ( ) > {
1483
- self . maybe_print_comment ( decl. span . lo ) ?;
1483
+ self . maybe_print_comment ( decl. span . lo ( ) ) ?;
1484
1484
match decl. node {
1485
1485
hir:: DeclLocal ( ref loc) => {
1486
1486
self . space_if_not_bol ( ) ?;
@@ -1523,7 +1523,7 @@ impl<'a> State<'a> {
1523
1523
path : & hir:: Path ,
1524
1524
colons_before_params : bool )
1525
1525
-> io:: Result < ( ) > {
1526
- self . maybe_print_comment ( path. span . lo ) ?;
1526
+ self . maybe_print_comment ( path. span . lo ( ) ) ?;
1527
1527
1528
1528
for ( i, segment) in path. segments . iter ( ) . enumerate ( ) {
1529
1529
if i > 0 {
@@ -1641,7 +1641,7 @@ impl<'a> State<'a> {
1641
1641
}
1642
1642
1643
1643
pub fn print_pat ( & mut self , pat : & hir:: Pat ) -> io:: Result < ( ) > {
1644
- self . maybe_print_comment ( pat. span . lo ) ?;
1644
+ self . maybe_print_comment ( pat. span . lo ( ) ) ?;
1645
1645
self . ann . pre ( self , NodePat ( pat) ) ?;
1646
1646
// Pat isn't normalized, but the beauty of it
1647
1647
// is that it doesn't matter
@@ -1897,7 +1897,7 @@ impl<'a> State<'a> {
1897
1897
match decl. output {
1898
1898
hir:: Return ( ref ty) => {
1899
1899
self . print_type ( & ty) ?;
1900
- self . maybe_print_comment ( ty. span . lo )
1900
+ self . maybe_print_comment ( ty. span . lo ( ) )
1901
1901
}
1902
1902
hir:: DefaultReturn ( ..) => unreachable ! ( ) ,
1903
1903
}
@@ -2074,7 +2074,7 @@ impl<'a> State<'a> {
2074
2074
self . end ( ) ?;
2075
2075
2076
2076
match decl. output {
2077
- hir:: Return ( ref output) => self . maybe_print_comment ( output. span . lo ) ,
2077
+ hir:: Return ( ref output) => self . maybe_print_comment ( output. span . lo ( ) ) ,
2078
2078
_ => Ok ( ( ) ) ,
2079
2079
}
2080
2080
}
@@ -2124,13 +2124,13 @@ impl<'a> State<'a> {
2124
2124
if ( * cmnt) . style != comments:: Trailing {
2125
2125
return Ok ( ( ) ) ;
2126
2126
}
2127
- let span_line = cm. lookup_char_pos ( span. hi ) ;
2127
+ let span_line = cm. lookup_char_pos ( span. hi ( ) ) ;
2128
2128
let comment_line = cm. lookup_char_pos ( ( * cmnt) . pos ) ;
2129
2129
let mut next = ( * cmnt) . pos + BytePos ( 1 ) ;
2130
2130
if let Some ( p) = next_pos {
2131
2131
next = p;
2132
2132
}
2133
- if span. hi < ( * cmnt) . pos && ( * cmnt) . pos < next &&
2133
+ if span. hi ( ) < ( * cmnt) . pos && ( * cmnt) . pos < next &&
2134
2134
span_line. line == comment_line. line {
2135
2135
self . print_comment ( cmnt) ?;
2136
2136
}
0 commit comments