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/item.rs | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) (limited to 'crates/completion/src/item.rs') diff --git a/crates/completion/src/item.rs b/crates/completion/src/item.rs index 83166df4e..65f8353e7 100644 --- a/crates/completion/src/item.rs +++ b/crates/completion/src/item.rs @@ -271,19 +271,18 @@ impl CompletionItem { pub struct ImportEdit { pub import_path: ModPath, pub import_scope: ImportScope, - pub merge_behavior: Option, } impl ImportEdit { /// Attempts to insert the import to the given scope, producing a text edit. /// May return no edit in edge cases, such as scope already containing the import. - pub fn to_text_edit(&self) -> Option { + pub fn to_text_edit(&self, merge_behavior: Option) -> Option { let _p = profile::span("ImportEdit::to_text_edit"); let rewriter = insert_use::insert_use( &self.import_scope, mod_path_to_ast(&self.import_path), - self.merge_behavior, + merge_behavior, ); let old_ast = rewriter.rewrite_root()?; let mut import_insert = TextEdit::builder(); -- cgit v1.2.3