Skip to content

Commit 45e343a

Browse files
committed
Minor
1 parent 9b2bd02 commit 45e343a

File tree

3 files changed

+10
-5
lines changed

3 files changed

+10
-5
lines changed

crates/ra_assists/src/handlers/auto_import.rs

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,12 @@ pub(crate) fn auto_import(acc: &mut Assists, ctx: &AssistContext) -> Option<()>
5050
format!("Import `{}`", &import),
5151
range,
5252
|builder| {
53-
insert_use_statement(&auto_import_assets.syntax_under_caret, &import, ctx, builder);
53+
insert_use_statement(
54+
&auto_import_assets.syntax_under_caret,
55+
&import,
56+
ctx,
57+
builder.text_edit_builder(),
58+
);
5459
},
5560
);
5661
}

crates/ra_assists/src/handlers/replace_qualified_name_with_use.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ pub(crate) fn replace_qualified_name_with_use(
3939
target,
4040
|builder| {
4141
let path_to_import = hir_path.mod_path().clone();
42-
insert_use_statement(path.syntax(), &path_to_import, ctx, builder);
42+
insert_use_statement(path.syntax(), &path_to_import, ctx, builder.text_edit_builder());
4343

4444
if let Some(last) = path.segment() {
4545
// Here we are assuming the assist will provide a correct use statement

crates/ra_assists/src/utils/insert_use.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ use ra_syntax::{
1111
};
1212
use ra_text_edit::TextEditBuilder;
1313

14-
use crate::assist_context::{AssistBuilder, AssistContext};
14+
use crate::assist_context::AssistContext;
1515

1616
/// Creates and inserts a use statement for the given path to import.
1717
/// The use statement is inserted in the scope most appropriate to the
@@ -21,7 +21,7 @@ pub(crate) fn insert_use_statement(
2121
position: &SyntaxNode,
2222
path_to_import: &ModPath,
2323
ctx: &AssistContext,
24-
builder: &mut AssistBuilder,
24+
builder: &mut TextEditBuilder,
2525
) {
2626
let target = path_to_import.to_string().split("::").map(SmolStr::new).collect::<Vec<_>>();
2727
let container = ctx.sema.ancestors_with_macros(position.clone()).find_map(|n| {
@@ -33,7 +33,7 @@ pub(crate) fn insert_use_statement(
3333

3434
if let Some(container) = container {
3535
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);
3737
}
3838
}
3939

0 commit comments

Comments
 (0)