aboutsummaryrefslogtreecommitdiff
path: root/crates/ra_assists/src/assists
diff options
context:
space:
mode:
authorKirill Bulatov <[email protected]>2020-01-26 23:53:59 +0000
committerKirill Bulatov <[email protected]>2020-01-26 23:53:59 +0000
commit9a6b5c6183b2d7aa3d577c3fb12d519721f4a4d0 (patch)
tree1c8444922d38a8ad536070bd89932fa1bd1d6272 /crates/ra_assists/src/assists
parent1a78991df69630b581b4210083c9e94157bab0e1 (diff)
Enforce alphabetical import sorting
Diffstat (limited to 'crates/ra_assists/src/assists')
-rw-r--r--crates/ra_assists/src/assists/auto_import.rs5
1 files 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<F: ImportsLocator>(
55 .filter_map(|module_def| module_with_name_to_import.find_use_path(ctx.db, module_def)) 55 .filter_map(|module_def| module_with_name_to_import.find_use_path(ctx.db, module_def))
56 .filter(|use_path| !use_path.segments.is_empty()) 56 .filter(|use_path| !use_path.segments.is_empty())
57 .take(20) 57 .take(20)
58 .collect::<std::collections::HashSet<_>>(); 58 .map(|import| import.to_string())
59 .collect::<std::collections::BTreeSet<_>>();
59 if proposed_imports.is_empty() { 60 if proposed_imports.is_empty() {
60 return None; 61 return None;
61 } 62 }
@@ -63,7 +64,7 @@ pub(crate) fn auto_import<F: ImportsLocator>(
63 ctx.add_assist_group(AssistId("auto_import"), "auto import", || { 64 ctx.add_assist_group(AssistId("auto_import"), "auto import", || {
64 proposed_imports 65 proposed_imports
65 .into_iter() 66 .into_iter()
66 .map(|import| import_to_action(import.to_string(), &position, &path_to_import)) 67 .map(|import| import_to_action(import, &position, &path_to_import))
67 .collect() 68 .collect()
68 }) 69 })
69} 70}