Skip to content

Lift imports to the top of the block #6445

Open
@musjj

Description

@musjj

A formatting option to lift up all imports to the top of the block would be nice.

Before:

use foo::a;

fn x() {
    println!("hello");
    use foo::b;
    use foo::c;
}

use foo::d;

mod z {
    fn y() {
        println!("world");
    }

    use foo::e;
}

use foo::f;

After:

use foo::a;
use foo::d;
use foo::f;

fn x() {
    use foo::b;
    use foo::c;

    println!("hello");

}

mod z {
    use foo::e;

    fn y() {
        println!("world");
    }
}

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions