Skip to content

Strange formatting with nested macro_rules! and long comment #4325

Closed
@Aaron1011

Description

@Aaron1011

Input

macro_rules! bad {
    () => {
        macro_rules! inner {
            () => {
                // This needs to have a width of over 100 characters to trigger the issue 12345678901
                ("a", "B")
            };
        }
    };
}

Output

macro_rules! bad {
    () => {
        macro_rules! inner {
                    () => {
                        // This needs to have a width of over 100 characters to trigger the issue 12345678901
                        ("a", "B")
                    };
                }
    };
}

Expected output

macro_rules! bad {
    () => {
        macro_rules! inner {
            () => {
                // This needs to have a width of over 100 characters to trigger the issue 12345678901
                ("a", "B")
            };
        }
    };
}

Meta

  • rustfmt version: rustfmt 1.4.16-stable (939e164 2020-06-11)
  • From where did you install rustfmt?: rustup

Modifying the comment to be less than 100 characters causes rustfmt to leave the code unchanged.

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions