From 19cfa5802eabddd5747bbdb04c81b50fc9f6e623 Mon Sep 17 00:00:00 2001 From: Kirill Bulatov Date: Sun, 6 Dec 2020 23:58:15 +0200 Subject: Simplify --- crates/completion/src/lib.rs | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'crates/completion') diff --git a/crates/completion/src/lib.rs b/crates/completion/src/lib.rs index 938c92dbb..066d589af 100644 --- a/crates/completion/src/lib.rs +++ b/crates/completion/src/lib.rs @@ -141,7 +141,7 @@ pub fn resolve_completion_edits( position: FilePosition, full_import_path: &str, imported_name: &str, -) -> Option { +) -> Option> { let ctx = CompletionContext::new(db, position, config)?; let anchor = ctx.name_ref_syntax.as_ref()?; let import_scope = ImportScope::find_insert_use_container(anchor.syntax(), &ctx.sema)?; @@ -156,7 +156,9 @@ pub fn resolve_completion_edits( }) .find(|mod_path| mod_path.to_string() == full_import_path)?; - ImportEdit { import_path, import_scope, merge_behaviour: config.merge }.to_text_edit() + ImportEdit { import_path, import_scope, merge_behaviour: config.merge } + .to_text_edit() + .map(|edit| vec![edit]) } #[cfg(test)] -- cgit v1.2.3