diff options
author | Mikhail Rakhmanov <[email protected]> | 2020-06-05 12:17:17 +0100 |
---|---|---|
committer | Mikhail Rakhmanov <[email protected]> | 2020-06-05 12:17:17 +0100 |
commit | 5dda9955380c6214aa5720ad640b76b870aaa556 (patch) | |
tree | 8f01ff6f3a1dc9a6e61b0b9bc0bc95cef74edc7c /crates/ra_assists/src/utils | |
parent | 74c3e7a1adf9d14bbac5cbbe9cd893d758f82561 (diff) |
Fix review comments
Diffstat (limited to 'crates/ra_assists/src/utils')
-rw-r--r-- | crates/ra_assists/src/utils/insert_use.rs | 11 |
1 files changed, 1 insertions, 10 deletions
diff --git a/crates/ra_assists/src/utils/insert_use.rs b/crates/ra_assists/src/utils/insert_use.rs index 114f5949a..0ee43482f 100644 --- a/crates/ra_assists/src/utils/insert_use.rs +++ b/crates/ra_assists/src/utils/insert_use.rs | |||
@@ -23,16 +23,7 @@ pub(crate) fn insert_use_statement( | |||
23 | ctx: &AssistContext, | 23 | ctx: &AssistContext, |
24 | builder: &mut TextEditBuilder, | 24 | builder: &mut TextEditBuilder, |
25 | ) { | 25 | ) { |
26 | insert_use_statement_with_string_path(position, &path_to_import.to_string(), ctx, builder); | 26 | let target = path_to_import.to_string().split("::").map(SmolStr::new).collect::<Vec<_>>(); |
27 | } | ||
28 | |||
29 | pub(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<_>>(); | ||
36 | 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| { |
37 | if let Some(module) = ast::Module::cast(n.clone()) { | 28 | if let Some(module) = ast::Module::cast(n.clone()) { |
38 | return module.item_list().map(|it| it.syntax().clone()); | 29 | return module.item_list().map(|it| it.syntax().clone()); |