Skip to content

rustfmt_skip is ignored on statements #1810

Closed
@solson

Description

@solson

Sort of a continuation of #1346. Note that attributes on statements are a stable feature now. Basic example:

fn main() {
    #[cfg_attr(rustfmt, rustfmt_skip)]
    foo(
        1, 2, 3, 4,
        1, 2,
        1, 2, 3,
    );
}

Clicking Format on this code should make no change, but it gets reformatted, so you have to put the attribute on the whole function instead, which may contain other code you do want rustfmt to reformat.

Thanks to #1602, rustfmt_skip actually does work with an expression attribute, but these are currently on nightly only.

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