aboutsummaryrefslogtreecommitdiff
path: root/crates/ra_assists/src/utils/insert_use.rs
diff options
context:
space:
mode:
authorBenjamin Coenen <[email protected]>2020-05-21 09:53:29 +0100
committerBenjamin Coenen <[email protected]>2020-05-21 09:53:29 +0100
commita7c8aa7c60c05db66ba4e89ae9e05c82e62507a5 (patch)
treee848f47bdf5d031c408df94222f595d2efcb2070 /crates/ra_assists/src/utils/insert_use.rs
parentc6143742bd4e625d391ac3ea860be7578ab9f53f (diff)
parenta4e6963a2313971fe7bbec97d03bc67266ef68a9 (diff)
add support of feature flag for runnables #4464
Signed-off-by: Benjamin Coenen <[email protected]>
Diffstat (limited to 'crates/ra_assists/src/utils/insert_use.rs')
-rw-r--r--crates/ra_assists/src/utils/insert_use.rs6
1 files changed, 3 insertions, 3 deletions
diff --git a/crates/ra_assists/src/utils/insert_use.rs b/crates/ra_assists/src/utils/insert_use.rs
index 1214e3cd4..0ee43482f 100644
--- a/crates/ra_assists/src/utils/insert_use.rs
+++ b/crates/ra_assists/src/utils/insert_use.rs
@@ -11,7 +11,7 @@ use ra_syntax::{
11}; 11};
12use ra_text_edit::TextEditBuilder; 12use ra_text_edit::TextEditBuilder;
13 13
14use crate::assist_context::{AssistBuilder, AssistContext}; 14use crate::assist_context::AssistContext;
15 15
16/// Creates and inserts a use statement for the given path to import. 16/// Creates and inserts a use statement for the given path to import.
17/// The use statement is inserted in the scope most appropriate to the 17/// The use statement is inserted in the scope most appropriate to the
@@ -21,7 +21,7 @@ pub(crate) fn insert_use_statement(
21 position: &SyntaxNode, 21 position: &SyntaxNode,
22 path_to_import: &ModPath, 22 path_to_import: &ModPath,
23 ctx: &AssistContext, 23 ctx: &AssistContext,
24 builder: &mut AssistBuilder, 24 builder: &mut TextEditBuilder,
25) { 25) {
26 let target = path_to_import.to_string().split("::").map(SmolStr::new).collect::<Vec<_>>(); 26 let target = path_to_import.to_string().split("::").map(SmolStr::new).collect::<Vec<_>>();
27 let container = ctx.sema.ancestors_with_macros(position.clone()).find_map(|n| { 27 let container = ctx.sema.ancestors_with_macros(position.clone()).find_map(|n| {
@@ -33,7 +33,7 @@ pub(crate) fn insert_use_statement(
33 33
34 if let Some(container) = container { 34 if let Some(container) = container {
35 let action = best_action_for_target(container, position.clone(), &target); 35 let action = best_action_for_target(container, position.clone(), &target);
36 make_assist(&action, &target, builder.text_edit_builder()); 36 make_assist(&action, &target, builder);
37 } 37 }
38} 38}
39 39