Skip to content

Commit

Permalink
Fixed ellipsis bug where rustfmt was creating code that could not be …
Browse files Browse the repository at this point in the history
…parsed
  • Loading branch information
chris authored and crw5996 committed Aug 24, 2018
1 parent 127a480 commit 4e748a2
Show file tree
Hide file tree
Showing 3 changed files with 41 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/patterns.rs
Expand Up @@ -369,7 +369,9 @@ fn rewrite_tuple_pat(
shape,
span,
context.config.max_width(),
if add_comma {
if dotdot_pos.is_some() {
Some(SeparatorTactic::Never)
} else if add_comma {
Some(SeparatorTactic::Always)
} else {
None
Expand Down
19 changes: 19 additions & 0 deletions tests/source/issue-2936.rs
@@ -0,0 +1,19 @@
struct AStruct {
A: u32,
B: u32,
C: u32,
}

impl Something for AStruct {
fn a_func() {
match a_val {
ContextualParseError::InvalidMediaRule(ref err) => {
let err: &CStr = match err.kind {
ParseErrorKind::Custom(StyleParseErrorKind::MediaQueryExpectedFeatureName(..)) => {
cstr!("PEMQExpectedFeatureName")
},
};
}
};
}
}
19 changes: 19 additions & 0 deletions tests/target/issue-2936.rs
@@ -0,0 +1,19 @@
struct AStruct {
A: u32,
B: u32,
C: u32,
}

impl Something for AStruct {
fn a_func() {
match a_val {
ContextualParseError::InvalidMediaRule(ref err) => {
let err: &CStr = match err.kind {
ParseErrorKind::Custom(StyleParseErrorKind::MediaQueryExpectedFeatureName(
..
)) => cstr!("PEMQExpectedFeatureName"),
};
}
};
}
}

0 comments on commit 4e748a2

Please sign in to comment.