This commit is contained in:
Aleksey Kladov 2021-03-09 17:42:05 +03:00
parent 2cc278c6ff
commit 444d67ae18
2 changed files with 7 additions and 8 deletions

View file

@ -430,11 +430,8 @@ impl Builder {
self.import_to_add = import_to_add; self.import_to_add = import_to_add;
self self
} }
pub(crate) fn set_ref_match( pub(crate) fn ref_match(mut self, ref_match: (Mutability, CompletionScore)) -> Builder {
mut self, self.ref_match = Some(ref_match);
ref_match: Option<(Mutability, CompletionScore)>,
) -> Builder {
self.ref_match = ref_match;
self self
} }
} }

View file

@ -246,7 +246,6 @@ impl<'a> Render<'a> {
} }
}; };
let mut ref_match = None;
if let ScopeDef::Local(local) = resolution { if let ScopeDef::Local(local) = resolution {
if let Some((active_name, active_type)) = self.ctx.active_name_and_type() { if let Some((active_name, active_type)) = self.ctx.active_name_and_type() {
let ty = local.ty(self.ctx.db()); let ty = local.ty(self.ctx.db());
@ -255,7 +254,11 @@ impl<'a> Render<'a> {
{ {
item = item.set_score(score); 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( Some(
item.kind(kind) item.kind(kind)
.add_import(import_to_add) .add_import(import_to_add)
.set_ref_match(ref_match)
.set_documentation(self.docs(resolution)) .set_documentation(self.docs(resolution))
.set_deprecated(self.is_deprecated(resolution)) .set_deprecated(self.is_deprecated(resolution))
.build(), .build(),