Skip to content

Error when formatting if let with && #5863

@momvart

Description

@momvart

If we chain multiple if let blocks into a single one with &&, rustfmt fails to format or gives

error[internal]: left behind trailing whitespace

Example:

fn main() {
    let x = Some(10);
    let y = None;

    if let Some(x) = x 
&& let Some(y) = y {
        println!("Hi");
    }
}

Version: 1.6.0-nightly (2023-07-27 500647f)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions