Skip to content

Configuration option to preserve blank lines at beginning of block #2868

@cmbrandenburg

Description

@cmbrandenburg

It would be nice if rustfmt had a configuration setting for preserving blank lines at the beginning of blocks.

For example, it would be nice if rustfmt converted this program…

fn main() {
    
    /* blah bleh bluh */
        println!("Hello world");
}

…into the following program:

fn main() {
    
    /* blah bleh bluh */
    println!("Hello world");
}

This preservation of space is especially important when the function signature spans several lines, as sometimes it's nice to have a visual break between a complex signature and the body of code.

There once was a configuration option called remove_blank_lines_at_start_or_end_of_block that did this, but it was removed as part of #1974 for reasons unapparent.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions