From 971b0836ef425d8b962ecac70a974887a8356567 Mon Sep 17 00:00:00 2001 From: Lukas Wirth Date: Mon, 31 May 2021 14:13:09 +0200 Subject: Use `Name`s instead of Strings in the completion rendering api --- crates/ide_completion/src/completions/lifetime.rs | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) (limited to 'crates/ide_completion/src/completions/lifetime.rs') diff --git a/crates/ide_completion/src/completions/lifetime.rs b/crates/ide_completion/src/completions/lifetime.rs index 5f6285b84..8ccccb646 100644 --- a/crates/ide_completion/src/completions/lifetime.rs +++ b/crates/ide_completion/src/completions/lifetime.rs @@ -16,15 +16,14 @@ pub(crate) fn complete_lifetime(acc: &mut Completions, ctx: &CompletionContext) (Some(lt), Some(lp)) if lp == lt.clone() => return, (Some(_), Some(lp)) => { lp_string = lp.to_string(); - Some(&lp_string) + Some(&*lp_string) } _ => None, }; ctx.scope.process_all_names(&mut |name, res| { if let ScopeDef::GenericParam(hir::GenericParam::LifetimeParam(_)) = res { - let name = name.to_string(); - if param_lifetime != Some(&name) { + if param_lifetime != Some(&*name.to_string()) { acc.add_resolution(ctx, name, &res); } } @@ -41,7 +40,7 @@ pub(crate) fn complete_label(acc: &mut Completions, ctx: &CompletionContext) { } ctx.scope.process_all_names(&mut |name, res| { if let ScopeDef::Label(_) = res { - acc.add_resolution(ctx, name.to_string(), &res); + acc.add_resolution(ctx, name, &res); } }); } -- cgit v1.2.3