Add commas after skipped arms when needed

This commit is contained in:
Seo Sanghyeon 2016-01-08 17:03:41 +09:00
parent bd32589ff5
commit 16b348dd9c
3 changed files with 17 additions and 2 deletions

View File

@ -898,8 +898,7 @@ impl Rewrite for ast::Arm {
attr_visitor.last_pos = attrs[0].span.lo;
if attr_visitor.visit_attrs(attrs) {
// Attributes included a skip instruction.
let snippet = context.snippet(mk_sp(attrs[0].span.lo, body.span.hi));
return Some(snippet);
return None;
}
attr_visitor.format_missing(pats[0].span.lo);
attr_visitor.buffer.to_string()

View File

@ -100,6 +100,14 @@ fn matches() {
}
}
fn match_skip() {
let _ = match Some(1) {
#[rustfmt_skip]
Some( n ) => n,
None => 1,
};
}
fn issue339() {
match a {
b => {}

View File

@ -115,6 +115,14 @@ fn matches() {
}
}
fn match_skip() {
let _ = match Some(1) {
#[rustfmt_skip]
Some( n ) => n,
None => 1,
};
}
fn issue339() {
match a {
b => {}