Skip to content

Redundant new line in if statement #4392

Open
@davidBar-On

Description

@davidBar-On

Input

fn main() {
    if 'a' == 0
    /* x */ as char {} }

fn main() {
    if 1234 == 'a'
    /* x */ as i32 {} }

fn main() {
    if 'a' == b // x
    as char {}
}

Output

fn main() {
    if 'a'
        == 0
    /* x */ as char
    {}
}

fn main() {
    if 1234
        == 'a'
    /* x */ as i32
    {}
}

fn main() {
    if 'a'
        == b // x
    as char
    {}
}

Expected output

fn main() {
    if 'a' == 0
    /* x */ as char
    {}
}

fn main() {
    if 1234 == 'a'
    /* x */ as i32
    {}
}

fn main() {
    if 'a' == b // x
    as char
    {}
}

Meta

  • rustfmt version: rustfmt 2.0.0-rc.2-nightly (688e472 2020-08-10)
  • From where did you install rustfmt?: local build from a clone (Linux WSL under Windows 10)

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions