Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Lift imports to the top of the block #6445

Open
musjj opened this issue Jan 14, 2025 · 0 comments
Open

Lift imports to the top of the block #6445

musjj opened this issue Jan 14, 2025 · 0 comments

Comments

@musjj
Copy link

musjj commented Jan 14, 2025

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");
    }
}
@musjj musjj changed the title Hoist imports to the top of the block Lift imports to the top of the block Jan 14, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants