Skip to content

Commit

Permalink
fix internal error when using rustfmt::skip with newline on stmt (rus…
Browse files Browse the repository at this point in the history
  • Loading branch information
rchaser53 authored and topecongiro committed Sep 15, 2019
1 parent dfe87fe commit 789a097
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 0 deletions.
5 changes: 5 additions & 0 deletions src/expr.rs
Original file line number Diff line number Diff line change
Expand Up @@ -516,6 +516,11 @@ pub(crate) fn rewrite_block_with_visitor(
let inner_attrs = attrs.map(inner_attributes);
let label_str = rewrite_label(label);
visitor.visit_block(block, inner_attrs.as_ref().map(|a| &**a), has_braces);
let visitor_context = visitor.get_context();
context
.skipped_range
.borrow_mut()
.append(&mut visitor_context.skipped_range.borrow_mut());
Some(format!("{}{}{}", prefix, label_str, visitor.buffer))
}

Expand Down
7 changes: 7 additions & 0 deletions tests/target/issue-3717.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
fn main() {
{
#[rustfmt::skip]
let _ =
[1];
}
}

0 comments on commit 789a097

Please sign in to comment.