Skip to content

rustfmt removes newlines in comments between chain calls #4012

Open
@vallentin

Description

@vallentin

Unsure if this is intentional, but I assume it isn't. rustfmt removes newlines in comments between chain calls. I can get behind removing newlines between line comments, but removing them in block comments I find odd.

Original Code:

Minimal example to reproduce issue.

let x = (0..3)
        /*
        Foo

        Bar
        */
        .map(|i| i + 1)
        // Foo

        // Bar
        .map(|i| i + 1)
        /*
        Foo


        Bar
        */
        .collect::<Vec<_>>();

Formatted Code:

let x = (0..3)
        /*
        Foo
        Bar
        */
        .map(|i| i + 1)
        // Foo
        // Bar
        .map(|i| i + 1)
        /*
        Foo
        Bar
        */
        .collect::<Vec<_>>();

rustfmt 1.4.9-stable (33e3667 2019-10-07)

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions