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
}
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
}
}

View file

@ -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(),