aboutsummaryrefslogtreecommitdiff
path: root/crates/ra_assists/src/utils
diff options
context:
space:
mode:
authorMikhail Rakhmanov <[email protected]>2020-06-04 09:03:44 +0100
committerMikhail Rakhmanov <[email protected]>2020-06-04 09:03:44 +0100
commitb0c8a2be7bd0d053eb9dd0e02fe2cf08b093a19a (patch)
treef80f886e29294e00f50a6e477cf770e71aa143b5 /crates/ra_assists/src/utils
parenta6d3c77bdd998499941a6aceccde85f7a94b804d (diff)
Remove AsName import
Diffstat (limited to 'crates/ra_assists/src/utils')
-rw-r--r--crates/ra_assists/src/utils/insert_use.rs11
1 files changed, 10 insertions, 1 deletions
diff --git a/crates/ra_assists/src/utils/insert_use.rs b/crates/ra_assists/src/utils/insert_use.rs
index 0ee43482f..114f5949a 100644
--- a/crates/ra_assists/src/utils/insert_use.rs
+++ b/crates/ra_assists/src/utils/insert_use.rs
@@ -23,7 +23,16 @@ pub(crate) fn insert_use_statement(
23 ctx: &AssistContext, 23 ctx: &AssistContext,
24 builder: &mut TextEditBuilder, 24 builder: &mut TextEditBuilder,
25) { 25) {
26 let target = path_to_import.to_string().split("::").map(SmolStr::new).collect::<Vec<_>>(); 26 insert_use_statement_with_string_path(position, &path_to_import.to_string(), ctx, builder);
27}
28
29pub(crate) fn insert_use_statement_with_string_path(
30 position: &SyntaxNode,
31 path_to_import: &str,
32 ctx: &AssistContext,
33 builder: &mut TextEditBuilder,
34) {
35 let target = path_to_import.split("::").map(SmolStr::new).collect::<Vec<_>>();
27 let container = ctx.sema.ancestors_with_macros(position.clone()).find_map(|n| { 36 let container = ctx.sema.ancestors_with_macros(position.clone()).find_map(|n| {
28 if let Some(module) = ast::Module::cast(n.clone()) { 37 if let Some(module) = ast::Module::cast(n.clone()) {
29 return module.item_list().map(|it| it.syntax().clone()); 38 return module.item_list().map(|it| it.syntax().clone());