Skip to content

Adding an attribute to an unsafe block changes its formatting #6106

Open
@tgross35

Description

@tgross35

This is the rustfmt result for an unsafe block:

fn main() {
    // #[cfg(not(fake_flag))]
    unsafe { println!() };
}

But uncomment the attribute, and it reformats it as:

fn main() {
    #[cfg(not(fake_flag))]
    unsafe {
        println!()
    };
}

Changing the attribute probably should not change the formatting.

rustfmt 1.7.0-nightly (5119208f 2024-03-02)

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions