Skip to content

Trailing commas in multi-line feature/lint group attributes are not preserved #4972

Closed
@PatchMixolydic

Description

@PatchMixolydic

I tried formatting the following code:

#![feature(
    allocator_api,
    array_methods,
    bool_to_option,
    control_flow_enum,
    decl_macro,
    destructuring_assignment,
    drain_filter,
    duration_consts_2,
    exact_size_is_empty,
    float_interpolation,
    hash_drain_filter,
    iter_intersperse,
    label_break_value,
    maybe_uninit_array_assume_init,
    maybe_uninit_extra,
    maybe_uninit_uninit_array,
    once_cell,
)]

I expected the trailing comma to be preserved, similar to multi-line structs or function calls. Instead, the comma was removed:

     maybe_uninit_uninit_array,
-    once_cell,
+    once_cell
 )]

rustfmt version: rustfmt 1.4.37-nightly (0035d9d 2021-08-16)

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions