From 076945e47c22d984067e0ce4d2f2016821e869e2 Mon Sep 17 00:00:00 2001 From: Aleksey Kladov Date: Thu, 10 Dec 2020 18:00:28 +0300 Subject: Minor, more orthogonal code It's better to accept things as arguments rather than store them. --- crates/completion/src/completions/unqualified_path.rs | 16 +++++++--------- 1 file changed, 7 insertions(+), 9 deletions(-) (limited to 'crates/completion/src/completions/unqualified_path.rs') diff --git a/crates/completion/src/completions/unqualified_path.rs b/crates/completion/src/completions/unqualified_path.rs index 3372fb1a2..544886d29 100644 --- a/crates/completion/src/completions/unqualified_path.rs +++ b/crates/completion/src/completions/unqualified_path.rs @@ -145,15 +145,13 @@ fn fuzzy_completion(acc: &mut Completions, ctx: &CompletionContext) -> Option<() }) .filter(|(mod_path, _)| mod_path.len() > 1) .filter_map(|(import_path, definition)| { - render_resolution_with_import( - RenderContext::new(ctx), - ImportEdit { - import_path: import_path.clone(), - import_scope: import_scope.clone(), - merge_behavior: ctx.config.merge, - }, - &definition, - ) + let ie = + ImportEdit { import_path: import_path.clone(), import_scope: import_scope.clone() }; + { + let _p = profile::span("totextedit"); + ie.to_text_edit(ctx.config.merge); + } + render_resolution_with_import(RenderContext::new(ctx), ie, &definition) }); acc.add_all(possible_imports); -- cgit v1.2.3