Merge pull request #1626 from topecongiro/issue-1623

Forbid trailing comma at the end of args of variadic functions
This commit is contained in:
Nick Cameron 2017-06-04 11:32:37 +12:00 committed by GitHub
commit 9f96233a35
3 changed files with 20 additions and 1 deletions

View File

@ -1944,7 +1944,11 @@ fn rewrite_args(context: &RewriteContext,
let fmt = ListFormatting {
tactic: tactic,
separator: ",",
trailing_separator: trailing_comma,
trailing_separator: if variadic {
SeparatorTactic::Never
} else {
trailing_comma
},
shape: Shape::legacy(budget, indent),
ends_with_newline: end_with_newline,
config: context.config,

View File

@ -14,3 +14,9 @@ extern "system" {
pub fn GetConsoleHistoryInfo(console_history_info: *mut ConsoleHistoryInfo) -> Boooooooooooooool;
}
// rustfmt should not add trailing comma for variadic function. See #1623.
extern "C" {
pub fn variadic_fn(first_parameter: FirstParameterType,
second_parameter: SecondParameterType,
...);
}

View File

@ -23,3 +23,12 @@ extern "system" {
console_history_info: *mut ConsoleHistoryInfo,
) -> Boooooooooooooool;
}
// rustfmt should not add trailing comma for variadic function. See #1623.
extern "C" {
pub fn variadic_fn(
first_parameter: FirstParameterType,
second_parameter: SecondParameterType,
...
);
}