From d346f5bf75bfe3c7dc357c748c257569c0fb23c3 Mon Sep 17 00:00:00 2001 From: Lukas Wirth Date: Fri, 28 May 2021 14:38:09 +0200 Subject: Less strings, more hir::Names --- crates/ide_completion/src/completions.rs | 6 +++--- crates/ide_completion/src/completions/unqualified_path.rs | 6 +++--- crates/ide_completion/src/render.rs | 8 ++++---- crates/ide_completion/src/render/function.rs | 6 +++--- 4 files changed, 13 insertions(+), 13 deletions(-) (limited to 'crates/ide_completion/src') diff --git a/crates/ide_completion/src/completions.rs b/crates/ide_completion/src/completions.rs index 0f0553a65..dd92bc510 100644 --- a/crates/ide_completion/src/completions.rs +++ b/crates/ide_completion/src/completions.rs @@ -74,7 +74,7 @@ impl Completions { pub(crate) fn add_field( &mut self, ctx: &CompletionContext, - receiver: Option, + receiver: Option, field: hir::Field, ty: &hir::Type, ) { @@ -85,7 +85,7 @@ impl Completions { pub(crate) fn add_tuple_field( &mut self, ctx: &CompletionContext, - receiver: Option, + receiver: Option, field: usize, ty: &hir::Type, ) { @@ -141,7 +141,7 @@ impl Completions { &mut self, ctx: &CompletionContext, func: hir::Function, - receiver: Option, + receiver: Option, local_name: Option, ) { if let Some(item) = render_method(RenderContext::new(ctx), None, receiver, local_name, func) diff --git a/crates/ide_completion/src/completions/unqualified_path.rs b/crates/ide_completion/src/completions/unqualified_path.rs index 573a39996..83cb67101 100644 --- a/crates/ide_completion/src/completions/unqualified_path.rs +++ b/crates/ide_completion/src/completions/unqualified_path.rs @@ -52,14 +52,14 @@ pub(crate) fn complete_unqualified_path(acc: &mut Completions, ctx: &CompletionC let ty = local.ty(ctx.db); super::complete_fields(ctx, &ty, |field, ty| match field { either::Either::Left(field) => { - acc.add_field(ctx, Some(name.to_string()), field, &ty) + acc.add_field(ctx, Some(name.clone()), field, &ty) } either::Either::Right(tuple_idx) => { - acc.add_tuple_field(ctx, Some(name.to_string()), tuple_idx, &ty) + acc.add_tuple_field(ctx, Some(name.clone()), tuple_idx, &ty) } }); super::complete_methods(ctx, &ty, |func| { - acc.add_method(ctx, func, Some(name.to_string()), None) + acc.add_method(ctx, func, Some(name.clone()), None) }); } } diff --git a/crates/ide_completion/src/render.rs b/crates/ide_completion/src/render.rs index bf59ff57b..97dd52851 100644 --- a/crates/ide_completion/src/render.rs +++ b/crates/ide_completion/src/render.rs @@ -25,7 +25,7 @@ use crate::{ pub(crate) fn render_field<'a>( ctx: RenderContext<'a>, - receiver: Option, + receiver: Option, field: hir::Field, ty: &hir::Type, ) -> CompletionItem { @@ -34,7 +34,7 @@ pub(crate) fn render_field<'a>( pub(crate) fn render_tuple_field<'a>( ctx: RenderContext<'a>, - receiver: Option, + receiver: Option, field: usize, ty: &hir::Type, ) -> CompletionItem { @@ -130,7 +130,7 @@ impl<'a> Render<'a> { fn render_field( &self, - receiver: Option, + receiver: Option, field: hir::Field, ty: &hir::Type, ) -> CompletionItem { @@ -163,7 +163,7 @@ impl<'a> Render<'a> { fn render_tuple_field( &self, - receiver: Option, + receiver: Option, field: usize, ty: &hir::Type, ) -> CompletionItem { diff --git a/crates/ide_completion/src/render/function.rs b/crates/ide_completion/src/render/function.rs index b3ba6114d..3ec77ca0f 100644 --- a/crates/ide_completion/src/render/function.rs +++ b/crates/ide_completion/src/render/function.rs @@ -26,7 +26,7 @@ pub(crate) fn render_fn<'a>( pub(crate) fn render_method<'a>( ctx: RenderContext<'a>, import_to_add: Option, - receiver: Option, + receiver: Option, local_name: Option, fn_: hir::Function, ) -> Option { @@ -38,7 +38,7 @@ pub(crate) fn render_method<'a>( struct FunctionRender<'a> { ctx: RenderContext<'a>, name: String, - receiver: Option, + receiver: Option, func: hir::Function, ast_node: Fn, is_method: bool, @@ -47,7 +47,7 @@ struct FunctionRender<'a> { impl<'a> FunctionRender<'a> { fn new( ctx: RenderContext<'a>, - receiver: Option, + receiver: Option, local_name: Option, fn_: hir::Function, is_method: bool, -- cgit v1.2.3