diff options
author | Aleksey Kladov <[email protected]> | 2020-02-07 14:12:51 +0000 |
---|---|---|
committer | Aleksey Kladov <[email protected]> | 2020-02-07 14:12:51 +0000 |
commit | aa64a84b493aa9c0b22f36b472a445d622cd2172 (patch) | |
tree | 8794dbbfbcde64194f074a53ea67a0da41d89317 /crates/ra_assists | |
parent | ce44547cfb4f16761bf5cbef87088f117fc07bdf (diff) |
Cleanups
Diffstat (limited to 'crates/ra_assists')
-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( |