Skip to content

Commit

Permalink
Merge pull request #2617 from topecongiro/issue-2616
Browse files Browse the repository at this point in the history
Preserve trailing comma on macro call when using mixed layout
  • Loading branch information
nrc committed Apr 12, 2018
2 parents 1cab171 + e58e977 commit ba5b4fa
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 4 deletions.
5 changes: 1 addition & 4 deletions src/lists.rs
Expand Up @@ -279,10 +279,7 @@ where
}

if last && formatting.ends_with_newline {
match formatting.trailing_separator {
SeparatorTactic::Always | SeparatorTactic::Vertical => separate = true,
_ => (),
}
separate = formatting.trailing_separator != SeparatorTactic::Never;
}

if line_len > 0 {
Expand Down
7 changes: 7 additions & 0 deletions tests/source/macros.rs
Expand Up @@ -373,3 +373,10 @@ fn foo() {
fn foo() {
let _ = column!(/* here */);
}

// #2616
// Preserve trailing comma when using mixed layout for macro call.
fn foo() {
foo!(1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1);
foo!(1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,);
}
13 changes: 13 additions & 0 deletions tests/target/macros.rs
Expand Up @@ -948,3 +948,16 @@ fn foo() {
fn foo() {
let _ = column!(/* here */);
}

// #2616
// Preserve trailing comma when using mixed layout for macro call.
fn foo() {
foo!(
1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1
);
foo!(
1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
);
}

0 comments on commit ba5b4fa

Please sign in to comment.