Don't use an untyped String for ActiveParam tracking

This commit is contained in:
Lukas Wirth 2021-03-20 23:22:09 +01:00
parent 5cc8ad0c4a
commit 38048c35d8
5 changed files with 44 additions and 24 deletions

View file

@ -243,7 +243,7 @@ impl<'a> Render<'a> {
item.set_relevance(CompletionRelevance {
exact_type_match: compute_exact_type_match(self.ctx.completion, &ty),
exact_name_match: compute_exact_name_match(self.ctx.completion, local_name.clone()),
exact_name_match: compute_exact_name_match(self.ctx.completion, &local_name),
is_local: true,
..CompletionRelevance::default()
});
@ -319,8 +319,7 @@ fn compute_exact_type_match(ctx: &CompletionContext, completion_ty: &hir::Type)
fn compute_exact_name_match(ctx: &CompletionContext, completion_name: impl Into<String>) -> bool {
let completion_name = completion_name.into();
Some(&completion_name) == ctx.expected_name.as_ref()
ctx.expected_name.as_ref().map_or(false, |name| name.text() == completion_name)
}
fn compute_ref_match(ctx: &CompletionContext, completion_ty: &hir::Type) -> Option<Mutability> {