From 9a6b5c6183b2d7aa3d577c3fb12d519721f4a4d0 Mon Sep 17 00:00:00 2001 From: Kirill Bulatov Date: Mon, 27 Jan 2020 01:53:59 +0200 Subject: Enforce alphabetical import sorting --- crates/ra_assists/src/assists/auto_import.rs | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/crates/ra_assists/src/assists/auto_import.rs b/crates/ra_assists/src/assists/auto_import.rs index 295fdf2e2..4c3793ac7 100644 --- a/crates/ra_assists/src/assists/auto_import.rs +++ b/crates/ra_assists/src/assists/auto_import.rs @@ -55,7 +55,8 @@ pub(crate) fn auto_import( .filter_map(|module_def| module_with_name_to_import.find_use_path(ctx.db, module_def)) .filter(|use_path| !use_path.segments.is_empty()) .take(20) - .collect::>(); + .map(|import| import.to_string()) + .collect::>(); if proposed_imports.is_empty() { return None; } @@ -63,7 +64,7 @@ pub(crate) fn auto_import( ctx.add_assist_group(AssistId("auto_import"), "auto import", || { proposed_imports .into_iter() - .map(|import| import_to_action(import.to_string(), &position, &path_to_import)) + .map(|import| import_to_action(import, &position, &path_to_import)) .collect() }) } -- cgit v1.2.3