mirror of
https://github.com/rust-lang/rust.git
synced 2025-06-04 19:29:07 +00:00
Add commas after skipped arms when needed
This commit is contained in:
parent
bd32589ff5
commit
16b348dd9c
@ -898,8 +898,7 @@ impl Rewrite for ast::Arm {
|
|||||||
attr_visitor.last_pos = attrs[0].span.lo;
|
attr_visitor.last_pos = attrs[0].span.lo;
|
||||||
if attr_visitor.visit_attrs(attrs) {
|
if attr_visitor.visit_attrs(attrs) {
|
||||||
// Attributes included a skip instruction.
|
// Attributes included a skip instruction.
|
||||||
let snippet = context.snippet(mk_sp(attrs[0].span.lo, body.span.hi));
|
return None;
|
||||||
return Some(snippet);
|
|
||||||
}
|
}
|
||||||
attr_visitor.format_missing(pats[0].span.lo);
|
attr_visitor.format_missing(pats[0].span.lo);
|
||||||
attr_visitor.buffer.to_string()
|
attr_visitor.buffer.to_string()
|
||||||
|
@ -100,6 +100,14 @@ fn matches() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fn match_skip() {
|
||||||
|
let _ = match Some(1) {
|
||||||
|
#[rustfmt_skip]
|
||||||
|
Some( n ) => n,
|
||||||
|
None => 1,
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
fn issue339() {
|
fn issue339() {
|
||||||
match a {
|
match a {
|
||||||
b => {}
|
b => {}
|
||||||
|
@ -115,6 +115,14 @@ fn matches() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fn match_skip() {
|
||||||
|
let _ = match Some(1) {
|
||||||
|
#[rustfmt_skip]
|
||||||
|
Some( n ) => n,
|
||||||
|
None => 1,
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
fn issue339() {
|
fn issue339() {
|
||||||
match a {
|
match a {
|
||||||
b => {}
|
b => {}
|
||||||
|
Loading…
Reference in New Issue
Block a user