Skip to content

Configuration for trailing commas does not affect macros defined with lists #6673

@PhenaOfMari

Description

@PhenaOfMari

Formatting for vec! macros will always follow a trailing_comma = "Vertical" style. Lists small enough to fit into one line will ignore a setting of "Always", while lists large enough to be displayed vertically will ignore "Never".

With no other configuration changes this code block will always be formatted to the following regardless of the setting for trailing commas:

    let short = vec![1.0, 2.0, 3.0];
    let long = vec![
        1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0, 9.0, 10.0, 11.0, 12.0, 13.0, 14.0, 15.0, 16.0,
        17.0, 18.0, 19.0, 20.0,
    ];

This likely applies to any other macro defined by a list as well, but vec! was what I found the issue with and I'm not sure off the top of my head if there are other macros defined by rust that engage with lists in this way.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions