aboutsummaryrefslogtreecommitdiff
path: root/crates/ide_completion
diff options
context:
space:
mode:
authorLukas Wirth <[email protected]>2021-05-28 13:38:09 +0100
committerLukas Wirth <[email protected]>2021-05-31 13:55:16 +0100
commitd346f5bf75bfe3c7dc357c748c257569c0fb23c3 (patch)
tree4ced7fd961a1f98467506dd4847fd877b75d2e47 /crates/ide_completion
parentca49fbe0a1f6acc1352f6628c36bb7dfe3a950e5 (diff)
Less strings, more hir::Names
Diffstat (limited to 'crates/ide_completion')
-rw-r--r--crates/ide_completion/src/completions.rs6
-rw-r--r--crates/ide_completion/src/completions/unqualified_path.rs6
-rw-r--r--crates/ide_completion/src/render.rs8
-rw-r--r--crates/ide_completion/src/render/function.rs6
4 files changed, 13 insertions, 13 deletions
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 {
74 pub(crate) fn add_field( 74 pub(crate) fn add_field(
75 &mut self, 75 &mut self,
76 ctx: &CompletionContext, 76 ctx: &CompletionContext,
77 receiver: Option<String>, 77 receiver: Option<hir::Name>,
78 field: hir::Field, 78 field: hir::Field,
79 ty: &hir::Type, 79 ty: &hir::Type,
80 ) { 80 ) {
@@ -85,7 +85,7 @@ impl Completions {
85 pub(crate) fn add_tuple_field( 85 pub(crate) fn add_tuple_field(
86 &mut self, 86 &mut self,
87 ctx: &CompletionContext, 87 ctx: &CompletionContext,
88 receiver: Option<String>, 88 receiver: Option<hir::Name>,
89 field: usize, 89 field: usize,
90 ty: &hir::Type, 90 ty: &hir::Type,
91 ) { 91 ) {
@@ -141,7 +141,7 @@ impl Completions {
141 &mut self, 141 &mut self,
142 ctx: &CompletionContext, 142 ctx: &CompletionContext,
143 func: hir::Function, 143 func: hir::Function,
144 receiver: Option<String>, 144 receiver: Option<hir::Name>,
145 local_name: Option<hir::Name>, 145 local_name: Option<hir::Name>,
146 ) { 146 ) {
147 if let Some(item) = render_method(RenderContext::new(ctx), None, receiver, local_name, func) 147 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
52 let ty = local.ty(ctx.db); 52 let ty = local.ty(ctx.db);
53 super::complete_fields(ctx, &ty, |field, ty| match field { 53 super::complete_fields(ctx, &ty, |field, ty| match field {
54 either::Either::Left(field) => { 54 either::Either::Left(field) => {
55 acc.add_field(ctx, Some(name.to_string()), field, &ty) 55 acc.add_field(ctx, Some(name.clone()), field, &ty)
56 } 56 }
57 either::Either::Right(tuple_idx) => { 57 either::Either::Right(tuple_idx) => {
58 acc.add_tuple_field(ctx, Some(name.to_string()), tuple_idx, &ty) 58 acc.add_tuple_field(ctx, Some(name.clone()), tuple_idx, &ty)
59 } 59 }
60 }); 60 });
61 super::complete_methods(ctx, &ty, |func| { 61 super::complete_methods(ctx, &ty, |func| {
62 acc.add_method(ctx, func, Some(name.to_string()), None) 62 acc.add_method(ctx, func, Some(name.clone()), None)
63 }); 63 });
64 } 64 }
65 } 65 }
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::{
25 25
26pub(crate) fn render_field<'a>( 26pub(crate) fn render_field<'a>(
27 ctx: RenderContext<'a>, 27 ctx: RenderContext<'a>,
28 receiver: Option<String>, 28 receiver: Option<hir::Name>,
29 field: hir::Field, 29 field: hir::Field,
30 ty: &hir::Type, 30 ty: &hir::Type,
31) -> CompletionItem { 31) -> CompletionItem {
@@ -34,7 +34,7 @@ pub(crate) fn render_field<'a>(
34 34
35pub(crate) fn render_tuple_field<'a>( 35pub(crate) fn render_tuple_field<'a>(
36 ctx: RenderContext<'a>, 36 ctx: RenderContext<'a>,
37 receiver: Option<String>, 37 receiver: Option<hir::Name>,
38 field: usize, 38 field: usize,
39 ty: &hir::Type, 39 ty: &hir::Type,
40) -> CompletionItem { 40) -> CompletionItem {
@@ -130,7 +130,7 @@ impl<'a> Render<'a> {
130 130
131 fn render_field( 131 fn render_field(
132 &self, 132 &self,
133 receiver: Option<String>, 133 receiver: Option<hir::Name>,
134 field: hir::Field, 134 field: hir::Field,
135 ty: &hir::Type, 135 ty: &hir::Type,
136 ) -> CompletionItem { 136 ) -> CompletionItem {
@@ -163,7 +163,7 @@ impl<'a> Render<'a> {
163 163
164 fn render_tuple_field( 164 fn render_tuple_field(
165 &self, 165 &self,
166 receiver: Option<String>, 166 receiver: Option<hir::Name>,
167 field: usize, 167 field: usize,
168 ty: &hir::Type, 168 ty: &hir::Type,
169 ) -> CompletionItem { 169 ) -> 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>(
26pub(crate) fn render_method<'a>( 26pub(crate) fn render_method<'a>(
27 ctx: RenderContext<'a>, 27 ctx: RenderContext<'a>,
28 import_to_add: Option<ImportEdit>, 28 import_to_add: Option<ImportEdit>,
29 receiver: Option<String>, 29 receiver: Option<hir::Name>,
30 local_name: Option<hir::Name>, 30 local_name: Option<hir::Name>,
31 fn_: hir::Function, 31 fn_: hir::Function,
32) -> Option<CompletionItem> { 32) -> Option<CompletionItem> {
@@ -38,7 +38,7 @@ pub(crate) fn render_method<'a>(
38struct FunctionRender<'a> { 38struct FunctionRender<'a> {
39 ctx: RenderContext<'a>, 39 ctx: RenderContext<'a>,
40 name: String, 40 name: String,
41 receiver: Option<String>, 41 receiver: Option<hir::Name>,
42 func: hir::Function, 42 func: hir::Function,
43 ast_node: Fn, 43 ast_node: Fn,
44 is_method: bool, 44 is_method: bool,
@@ -47,7 +47,7 @@ struct FunctionRender<'a> {
47impl<'a> FunctionRender<'a> { 47impl<'a> FunctionRender<'a> {
48 fn new( 48 fn new(
49 ctx: RenderContext<'a>, 49 ctx: RenderContext<'a>,
50 receiver: Option<String>, 50 receiver: Option<hir::Name>,
51 local_name: Option<hir::Name>, 51 local_name: Option<hir::Name>,
52 fn_: hir::Function, 52 fn_: hir::Function,
53 is_method: bool, 53 is_method: bool,