close
Skip to content

Wrong shape used when rewriting inner attributes in match expression #6147

Description

@ytmimi

The indentation of the second inner attribute isn't correct.

version: rustfmt 1.7.0-nightly (72893919 2024-04-07) -- built from rust-lang/rustfmt source.
commit: 7289391
configs used: defaults

Input

pub fn main() {
    match a {
        #![attr1]
        #![attr2]
        _ => None,
    }
}

output

pub fn main() {
    match a {
        #![attr1]
    #![attr2]
        _ => None,
    }
}

The fix will likely involve pass an indented shape when calling inner_attrs.rewrite().

.rewrite(context, shape)

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-matchesArea: match arms, patterns, blocks, etcI-poor-formattingIssue: poor formattinggood first issueIssues up for grabs, also good candidates for new rustfmt contributors

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions