From 444d67ae1802d2832b3bcdc0ff593b014477b37b Mon Sep 17 00:00:00 2001 From: Aleksey Kladov Date: Tue, 9 Mar 2021 17:42:05 +0300 Subject: Cleanup --- crates/ide_completion/src/item.rs | 7 ++----- crates/ide_completion/src/render.rs | 8 +++++--- 2 files changed, 7 insertions(+), 8 deletions(-) (limited to 'crates') diff --git a/crates/ide_completion/src/item.rs b/crates/ide_completion/src/item.rs index 9b039e3e5..b6bc11da2 100644 --- a/crates/ide_completion/src/item.rs +++ b/crates/ide_completion/src/item.rs @@ -430,11 +430,8 @@ impl Builder { self.import_to_add = import_to_add; self } - pub(crate) fn set_ref_match( - mut self, - ref_match: Option<(Mutability, CompletionScore)>, - ) -> Builder { - self.ref_match = ref_match; + pub(crate) fn ref_match(mut self, ref_match: (Mutability, CompletionScore)) -> Builder { + self.ref_match = Some(ref_match); self } } diff --git a/crates/ide_completion/src/render.rs b/crates/ide_completion/src/render.rs index fae5685e2..0a6ac8804 100644 --- a/crates/ide_completion/src/render.rs +++ b/crates/ide_completion/src/render.rs @@ -246,7 +246,6 @@ impl<'a> Render<'a> { } }; - let mut ref_match = None; if let ScopeDef::Local(local) = resolution { if let Some((active_name, active_type)) = self.ctx.active_name_and_type() { let ty = local.ty(self.ctx.db()); @@ -255,7 +254,11 @@ impl<'a> Render<'a> { { item = item.set_score(score); } - ref_match = refed_type_matches(&active_type, &active_name, &ty, &local_name); + if let Some(ref_match) = + refed_type_matches(&active_type, &active_name, &ty, &local_name) + { + item = item.ref_match(ref_match); + } } } @@ -285,7 +288,6 @@ impl<'a> Render<'a> { Some( item.kind(kind) .add_import(import_to_add) - .set_ref_match(ref_match) .set_documentation(self.docs(resolution)) .set_deprecated(self.is_deprecated(resolution)) .build(), -- cgit v1.2.3