Skip to content

BUG: Fails to keep a space before range .. when its LHS is a binary operation whose RHS is a float literal ending with . #6175

@TonalidadeHidrica

Description

@TonalidadeHidrica

I wonder how I can make the title short 🤔

In the following code, the space between 1. and .. must be kept, as together they form an illegal token ....

fn main() {
    let a = 0. + 1. ..2.;
}

Expected: no changes, found:

fn main() {
    let a = 0. + 1...2.;
}

Related: #3854 , but it only handles the case when LHS of .. is not a binary expression. Indeed, this code is not modified by rustfmt as expected:

fn main() {
    let a = 1. ..2.;
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions