Skip to content

Commit 444d67a

Browse files
committed
Cleanup
1 parent 2cc278c commit 444d67a

File tree

2 files changed

+7
-8
lines changed

2 files changed

+7
-8
lines changed

crates/ide_completion/src/item.rs

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -430,11 +430,8 @@ impl Builder {
430430
self.import_to_add = import_to_add;
431431
self
432432
}
433-
pub(crate) fn set_ref_match(
434-
mut self,
435-
ref_match: Option<(Mutability, CompletionScore)>,
436-
) -> Builder {
437-
self.ref_match = ref_match;
433+
pub(crate) fn ref_match(mut self, ref_match: (Mutability, CompletionScore)) -> Builder {
434+
self.ref_match = Some(ref_match);
438435
self
439436
}
440437
}

crates/ide_completion/src/render.rs

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -246,7 +246,6 @@ impl<'a> Render<'a> {
246246
}
247247
};
248248

249-
let mut ref_match = None;
250249
if let ScopeDef::Local(local) = resolution {
251250
if let Some((active_name, active_type)) = self.ctx.active_name_and_type() {
252251
let ty = local.ty(self.ctx.db());
@@ -255,7 +254,11 @@ impl<'a> Render<'a> {
255254
{
256255
item = item.set_score(score);
257256
}
258-
ref_match = refed_type_matches(&active_type, &active_name, &ty, &local_name);
257+
if let Some(ref_match) =
258+
refed_type_matches(&active_type, &active_name, &ty, &local_name)
259+
{
260+
item = item.ref_match(ref_match);
261+
}
259262
}
260263
}
261264

@@ -285,7 +288,6 @@ impl<'a> Render<'a> {
285288
Some(
286289
item.kind(kind)
287290
.add_import(import_to_add)
288-
.set_ref_match(ref_match)
289291
.set_documentation(self.docs(resolution))
290292
.set_deprecated(self.is_deprecated(resolution))
291293
.build(),

0 commit comments

Comments
 (0)