Skip to content

Add an assist handler "move_use_to_top_level" to move use statement to top level #20374

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

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

sgasho
Copy link
Contributor

@sgasho sgasho commented Aug 3, 2025

closes: #20326

fn main() {
     use std::collections::HashMap$0;
     let map = HashMap::new();
}

use std::collections::HashMap;

fn main() {
    let map = HashMap::new();
}

Attributes and comments will be moved to the top level simultaneously.

example

fn main() {
    #[allow(unused)]
    use std::collections::HashMap$0;
    let map = HashMap::new();
}

#[allow(unused)]
use std::collections::HashMap;

fn main() {
    let map = HashMap::new();
}

@rustbot rustbot added the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. label Aug 3, 2025
@sgasho sgasho force-pushed the feat/assis_move_use_stmt_to_top branch 2 times, most recently from 540fa16 to 24a791b Compare August 3, 2025 15:05
@sgasho sgasho force-pushed the feat/assis_move_use_stmt_to_top branch from 24a791b to 1e8df91 Compare August 3, 2025 15:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
S-waiting-on-review Status: Awaiting review from the assignee but also interested parties.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

assist: move use statement to top level
2 participants