Skip to content

dslx_fmt should not insert blank line before comments between functions #1997

@proppy

Description

@proppy

Describe the bug
Not sure if that's intentional, but it seems that dslx_fmt systematically insert a blank line on a comment that appear between two functions.

To Reproduce

fn foo() -> u32 {
    let a = 0;
    a
}
// foo

#[test]
fn foo_test() {
    let x = foo();
    assert_eq(x, u32:0);
}

gets reformatted as:

fn foo() -> u32 {
    let a = 0;
    a
}

// foo

#[test]
fn foo_test() {
    let x = foo();
    assert_eq(x, u32:0);
}

Expected behavior

dslx_fmt doesn't insert a blank line before the comment.

Additional context

Note that this doesn't happen if the function is last in the file:

fn foo() -> u32 {
    let a = 0;
    a
}
// foo

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    Status

    No status

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions