Skip to content

"error[internal]: left behind trailing whitespace" with long macro inside closure #6659

@kryptan

Description

@kryptan

Code:

fn main() {
    true.then(|| { 
        println! { "{}",
                                                                                                    0
        };
    });
}

Error:

error[internal]: left behind trailing whitespace
 --> /playground/src/main.rs:2:2:19
  |
2 |     true.then(|| { 
  |                   ^
  |

warning: rustfmt has failed to format. See previous 1 errors.

Playground link

There are a lot of issues with "left behind trailing whitespace" but I couldn't find any sufficiently similar to this one.


Tested on:
1.89 stable
1.91.0-nightly (2025-09-11)

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