Skip to content

struct_field_align_threshold breaks struct update syntax inside matches! macro #4926

Closed
@jrose-signal

Description

@jrose-signal

Sending the following code through rustfmt --config struct_field_align_threshold=30 removes the .., changing the meaning of the code.

struct X { a: i32, b: i32 }

fn test(x: X) {
    let y = matches!(x, X {
        a: 1,
        ..
    });
}

becomes

struct X {
    a: i32,
    b: i32,
}

fn test(x: X) {
    let y = matches!(x, X { a: 1 });
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    2x-port:pendinggood first issueIssues up for grabs, also good candidates for new rustfmt contributorshelp wantedonly-with-optionrequires a non-default option value to reproduce

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions