diff options
author | bors[bot] <26634292+bors[bot]@users.noreply.github.com> | 2020-05-20 10:10:52 +0100 |
---|---|---|
committer | GitHub <[email protected]> | 2020-05-20 10:10:52 +0100 |
commit | 4d3fd62f897da50db1b203b86f45b9d2cd272b4d (patch) | |
tree | 595b6ff2205303b2eeb55a275ac0d364742732e6 /crates/ra_assists/src/utils/insert_use.rs | |
parent | b422cef7dce4d98391de2a108001a49ae1c9625a (diff) | |
parent | 33e111483fbc80c017037e0b158ee652ed41b3e8 (diff) |
Merge #4530
4530: Use snippets in change_return_type_to_result r=matklad a=matklad
bors r+
🤖
Co-authored-by: Aleksey Kladov <[email protected]>
Diffstat (limited to 'crates/ra_assists/src/utils/insert_use.rs')
-rw-r--r-- | crates/ra_assists/src/utils/insert_use.rs | 6 |
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 | }; |
12 | use ra_text_edit::TextEditBuilder; | 12 | use ra_text_edit::TextEditBuilder; |
13 | 13 | ||
14 | use crate::assist_context::{AssistBuilder, AssistContext}; | 14 | use 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 | ||