Skip to content

fn_params_layout = "Vertical" removes single argument's trailing comma #6889

@jasonaowen

Description

@jasonaowen

Summary

When fn_params_layout is set to Vertical, the trailing comma is removed when there is a single argument and the function name, parameter name, parameter type, or return type is long enough to ensure a multiline layout.

When fn_params_layout is set to Tall (the default), the trailing comma is emitted, as expected.

Example

I tried to format this code:

trait _MultilineFunctions {
    fn long_param_name(
        very_very_very_very_very_very_very_very_very_very_very_long_param_name: String
    );

    fn long_param_type(
        s: Option<Option<Option<Option<Option<Option<Option<Option<Option<String>>>>>>>>>
    );

    fn long_return_type(
        s: String
    ) -> Option<Option<Option<Option<Option<Option<Option<Option<Option<String>>>>>>>>>;

    fn very_very_very_very_very_very_very_very_very_very_very_long_function_name(
        s: String
    ) -> String;
}

Expected behavior

I expected to see this happen: the single arguments would each have a trailing comma: s: String,.

Actual behavior

Instead, this happened: no trailing commas were emitted, and existing trailing commas were removed.

Configuration

# rustfmt.toml
fn_params_layout = "Vertical"

Meta

rustfmt --version:

rustfmt 1.9.0-stable (59807616e1 2026-04-14)

The same behavior appears on nightly, when run as rustup run nightly cargo fmt.

rustup run nightly rustfmt --version:

rustfmt 1.9.0-nightly (82bee96507 2026-05-09)

Metadata

Metadata

Assignees

No one assigned

    Labels

    C-bugCategory: this is a bug; use also I-* labels for specific bug kinds, e.g. I-non-idempotency or I-ICEneeds-triageThis issue or PR needs triaging to determine its status. Remove label once sufficiently triaged.

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions