diff options
Diffstat (limited to 'crates')
-rw-r--r-- | crates/ra_assists/src/assists/auto_import.rs | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/crates/ra_assists/src/assists/auto_import.rs b/crates/ra_assists/src/assists/auto_import.rs index 18ea98105..84b5474f9 100644 --- a/crates/ra_assists/src/assists/auto_import.rs +++ b/crates/ra_assists/src/assists/auto_import.rs | |||
@@ -9,6 +9,7 @@ use crate::{ | |||
9 | assist_ctx::{ActionBuilder, Assist, AssistCtx}, | 9 | assist_ctx::{ActionBuilder, Assist, AssistCtx}, |
10 | auto_import_text_edit, AssistId, | 10 | auto_import_text_edit, AssistId, |
11 | }; | 11 | }; |
12 | use std::collections::BTreeSet; | ||
12 | 13 | ||
13 | // Assist: auto_import | 14 | // Assist: auto_import |
14 | // | 15 | // |
@@ -60,7 +61,8 @@ pub(crate) fn auto_import(ctx: AssistCtx) -> Option<Assist> { | |||
60 | .filter_map(|module_def| module_with_name_to_import.find_use_path(ctx.db, module_def)) | 61 | .filter_map(|module_def| module_with_name_to_import.find_use_path(ctx.db, module_def)) |
61 | .filter(|use_path| !use_path.segments.is_empty()) | 62 | .filter(|use_path| !use_path.segments.is_empty()) |
62 | .take(20) | 63 | .take(20) |
63 | .collect::<std::collections::BTreeSet<_>>(); | 64 | .collect::<BTreeSet<_>>(); |
65 | |||
64 | if proposed_imports.is_empty() { | 66 | if proposed_imports.is_empty() { |
65 | return None; | 67 | return None; |
66 | } | 68 | } |
@@ -82,9 +84,10 @@ fn import_to_action(import: ModPath, position: &SyntaxNode, anchor: &SyntaxNode) | |||
82 | 84 | ||
83 | #[cfg(test)] | 85 | #[cfg(test)] |
84 | mod tests { | 86 | mod tests { |
85 | use super::*; | ||
86 | use crate::helpers::{check_assist, check_assist_not_applicable}; | 87 | use crate::helpers::{check_assist, check_assist_not_applicable}; |
87 | 88 | ||
89 | use super::*; | ||
90 | |||
88 | #[test] | 91 | #[test] |
89 | fn applicable_when_found_an_import() { | 92 | fn applicable_when_found_an_import() { |
90 | check_assist( | 93 | check_assist( |