Skip to content

Commit 7348844

Browse files
committed
Avoid suggesting redundant borrowing in completion results
1 parent da06b7c commit 7348844

File tree

1 file changed

+1
-3
lines changed
  • src/tools/rust-analyzer/crates/ide-completion/src

1 file changed

+1
-3
lines changed

src/tools/rust-analyzer/crates/ide-completion/src/render.rs

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -628,11 +628,9 @@ fn compute_ref_match(
628628
let expected_type = ctx.expected_type.as_ref()?;
629629
let expected_without_ref = expected_type.remove_ref();
630630
let completion_without_ref = completion_ty.remove_ref();
631-
632-
if completion_ty == expected_type {
631+
if expected_type.could_unify_with(ctx.db, completion_ty) {
633632
return None;
634633
}
635-
636634
if let Some(expected_without_ref) = &expected_without_ref {
637635
if completion_ty.autoderef(ctx.db).any(|ty| ty == *expected_without_ref) {
638636
cov_mark::hit!(suggest_ref);

0 commit comments

Comments
 (0)