aboutsummaryrefslogtreecommitdiff
path: root/crates/ra_assists/src/auto_import.rs
diff options
context:
space:
mode:
Diffstat (limited to 'crates/ra_assists/src/auto_import.rs')
-rw-r--r--crates/ra_assists/src/auto_import.rs18
1 files changed, 12 insertions, 6 deletions
diff --git a/crates/ra_assists/src/auto_import.rs b/crates/ra_assists/src/auto_import.rs
index 43e75eee1..a32e2f9b6 100644
--- a/crates/ra_assists/src/auto_import.rs
+++ b/crates/ra_assists/src/auto_import.rs
@@ -562,9 +562,12 @@ pub(crate) fn auto_import(mut ctx: AssistCtx<impl HirDatabase>) -> Option<Assist
562 AssistId("auto_import"), 562 AssistId("auto_import"),
563 format!("import {} in mod {}", fmt_segments(&segments), name.text()), 563 format!("import {} in mod {}", fmt_segments(&segments), name.text()),
564 |edit| { 564 |edit| {
565 let mut text_edit = TextEditBuilder::default(); 565 apply_auto_import(
566 apply_auto_import(item_list.syntax(), &path, &segments, &mut text_edit); 566 item_list.syntax(),
567 edit.set_edit_builder(text_edit); 567 &path,
568 &segments,
569 edit.text_edit_builder(),
570 );
568 }, 571 },
569 ); 572 );
570 } 573 }
@@ -574,9 +577,12 @@ pub(crate) fn auto_import(mut ctx: AssistCtx<impl HirDatabase>) -> Option<Assist
574 AssistId("auto_import"), 577 AssistId("auto_import"),
575 format!("import {} in the current file", fmt_segments(&segments)), 578 format!("import {} in the current file", fmt_segments(&segments)),
576 |edit| { 579 |edit| {
577 let mut text_edit = TextEditBuilder::default(); 580 apply_auto_import(
578 apply_auto_import(current_file.syntax(), &path, &segments, &mut text_edit); 581 current_file.syntax(),
579 edit.set_edit_builder(text_edit); 582 &path,
583 &segments,
584 edit.text_edit_builder(),
585 );
580 }, 586 },
581 ); 587 );
582 } 588 }