File tree Expand file tree Collapse file tree 2 files changed +12
-1
lines changed Expand file tree Collapse file tree 2 files changed +12
-1
lines changed Original file line number Diff line number Diff line change @@ -517,6 +517,11 @@ pub(crate) fn rewrite_block_with_visitor(
517
517
let inner_attrs = attrs. map ( inner_attributes) ;
518
518
let label_str = rewrite_label ( label) ;
519
519
visitor. visit_block ( block, inner_attrs. as_ref ( ) . map ( |a| & * * a) , has_braces) ;
520
+ let visitor_context = visitor. get_context ( ) ;
521
+ context
522
+ . skipped_range
523
+ . borrow_mut ( )
524
+ . append ( & mut visitor_context. skipped_range . borrow_mut ( ) . clone ( ) ) ;
520
525
Some ( format ! ( "{}{}{}" , prefix, label_str, visitor. buffer) )
521
526
}
522
527
Original file line number Diff line number Diff line change @@ -120,11 +120,17 @@ impl<'b, 'a: 'b> FmtVisitor<'a> {
120
120
ast:: StmtKind :: Local ( ..) | ast:: StmtKind :: Expr ( ..) | ast:: StmtKind :: Semi ( ..) => {
121
121
let attrs = get_attrs_from_stmt ( stmt. as_ast_node ( ) ) ;
122
122
if contains_skip ( attrs) {
123
+ let span = stmt. span ( ) ;
123
124
self . push_skipped_with_span (
124
125
attrs,
125
- stmt . span ( ) ,
126
+ span,
126
127
get_span_without_attrs ( stmt. as_ast_node ( ) ) ,
127
128
) ;
129
+ let context = self . get_context ( ) ;
130
+ context. skipped_range . borrow_mut ( ) . push ( (
131
+ context. source_map . lookup_line ( span. lo ( ) ) . unwrap ( ) . line ,
132
+ context. source_map . lookup_line ( span. hi ( ) ) . unwrap ( ) . line ,
133
+ ) ) ;
128
134
} else {
129
135
let shape = self . shape ( ) ;
130
136
let rewrite = self . with_context ( |ctx| stmt. rewrite ( & ctx, shape) ) ;
You can’t perform that action at this time.
0 commit comments