From 12fe301a0cbe4ffecdabae1c9b827e740e3ce027 Mon Sep 17 00:00:00 2001 From: Aleksey Kladov Date: Tue, 9 Mar 2021 18:06:08 +0300 Subject: Cleanup auto-ref in completion --- crates/ide_completion/src/item.rs | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) (limited to 'crates/ide_completion/src/item.rs') diff --git a/crates/ide_completion/src/item.rs b/crates/ide_completion/src/item.rs index b16f0775a..5e8ed75f1 100644 --- a/crates/ide_completion/src/item.rs +++ b/crates/ide_completion/src/item.rs @@ -68,7 +68,7 @@ pub struct CompletionItem { /// Indicates that a reference or mutable reference to this variable is a /// possible match. - ref_match: Option<(Mutability, CompletionScore)>, + ref_match: Option, /// The import data to add to completion's edits. import_to_add: Option, @@ -104,6 +104,9 @@ impl fmt::Debug for CompletionItem { if let Some(score) = &self.score { s.field("score", score); } + if let Some(mutability) = &self.ref_match { + s.field("ref_match", &format!("&{}", mutability.as_keyword_for_ref())); + } if self.trigger_call_info { s.field("trigger_call_info", &true); } @@ -261,7 +264,7 @@ impl CompletionItem { self.trigger_call_info } - pub fn ref_match(&self) -> Option<(Mutability, CompletionScore)> { + pub fn ref_match(&self) -> Option { self.ref_match } @@ -311,7 +314,7 @@ pub(crate) struct Builder { deprecated: bool, trigger_call_info: Option, score: Option, - ref_match: Option<(Mutability, CompletionScore)>, + ref_match: Option, } impl Builder { @@ -430,8 +433,8 @@ impl Builder { self.import_to_add = import_to_add; self } - pub(crate) fn ref_match(mut self, ref_match: (Mutability, CompletionScore)) -> Builder { - self.ref_match = Some(ref_match); + pub(crate) fn ref_match(mut self, mutability: Mutability) -> Builder { + self.ref_match = Some(mutability); self } } -- cgit v1.2.3