Include trailing comma in single param vertical fn#6890
Open
jasonaowen wants to merge 1 commit into
Open
Conversation
jieyouxu
requested changes
May 30, 2026
Member
There was a problem hiding this comment.
Thanks. Considering
- Self-consistency with
fn_params_layout = "Tall"which already adds trailing commas for single param fn, and - Inserting a trailing comma is generally better for minimizing extra diff lines
This makes sense to me. However, I think the fix needs to be gated behind a style edition.
Collaborator
|
Reminder, once the PR becomes ready for a review, use |
41bcf3d to
0ff3f6c
Compare
Collaborator
|
This PR was rebased onto a different main commit. Here's a range-diff highlighting what actually changed. Rebasing is a normal part of keeping PRs up to date, so no action is needed—this note is just to help reviewers. |
jasonaowen
commented
Jun 12, 2026
jieyouxu
reviewed
Jun 12, 2026
When formatting a function with a single parameter with `fn_params_layout` set to `Vertical`, the previous tactic would remove any trailing commas before spilling to multiple lines for other reasons, such as long function names or return types. Instead, use the same tactic as `Tall` does, so that the trailing comma is kept if the end result spans multiple lines. `fn_params_layout = "Vertical"` is stable, so this is a breaking change. Guard on the style edition so that it only takes effect starting in the next edition. Issue rust-lang#6889 `fn_params_layout = "Vertical"` removes single argument's trailing comma
0ff3f6c to
20a023d
Compare
jieyouxu
approved these changes
Jun 13, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
When formatting a function with a single parameter with
fn_params_layoutset toVertical, the previous tactic would remove any trailing commas before spilling to multiple lines for other reasons, such as long function names or return types. Instead, use the same tactic asTalldoes, so that the trailing comma is kept if the end result spans multiple lines.Resolves #6889
fn_params_layout = "Vertical"removes single argument's trailing comma