Less strings, more hir::Names
This commit is contained in:
parent
ca49fbe0a1
commit
d346f5bf75
@ -74,7 +74,7 @@ pub(crate) fn add_all<I>(&mut self, items: I)
|
||||
pub(crate) fn add_field(
|
||||
&mut self,
|
||||
ctx: &CompletionContext,
|
||||
receiver: Option<String>,
|
||||
receiver: Option<hir::Name>,
|
||||
field: hir::Field,
|
||||
ty: &hir::Type,
|
||||
) {
|
||||
@ -85,7 +85,7 @@ pub(crate) fn add_field(
|
||||
pub(crate) fn add_tuple_field(
|
||||
&mut self,
|
||||
ctx: &CompletionContext,
|
||||
receiver: Option<String>,
|
||||
receiver: Option<hir::Name>,
|
||||
field: usize,
|
||||
ty: &hir::Type,
|
||||
) {
|
||||
@ -141,7 +141,7 @@ pub(crate) fn add_method(
|
||||
&mut self,
|
||||
ctx: &CompletionContext,
|
||||
func: hir::Function,
|
||||
receiver: Option<String>,
|
||||
receiver: Option<hir::Name>,
|
||||
local_name: Option<hir::Name>,
|
||||
) {
|
||||
if let Some(item) = render_method(RenderContext::new(ctx), None, receiver, local_name, func)
|
||||
|
@ -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)
|
||||
});
|
||||
}
|
||||
}
|
||||
|
@ -25,7 +25,7 @@
|
||||
|
||||
pub(crate) fn render_field<'a>(
|
||||
ctx: RenderContext<'a>,
|
||||
receiver: Option<String>,
|
||||
receiver: Option<hir::Name>,
|
||||
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<String>,
|
||||
receiver: Option<hir::Name>,
|
||||
field: usize,
|
||||
ty: &hir::Type,
|
||||
) -> CompletionItem {
|
||||
@ -130,7 +130,7 @@ fn new(ctx: RenderContext<'a>) -> Render<'a> {
|
||||
|
||||
fn render_field(
|
||||
&self,
|
||||
receiver: Option<String>,
|
||||
receiver: Option<hir::Name>,
|
||||
field: hir::Field,
|
||||
ty: &hir::Type,
|
||||
) -> CompletionItem {
|
||||
@ -163,7 +163,7 @@ fn render_field(
|
||||
|
||||
fn render_tuple_field(
|
||||
&self,
|
||||
receiver: Option<String>,
|
||||
receiver: Option<hir::Name>,
|
||||
field: usize,
|
||||
ty: &hir::Type,
|
||||
) -> CompletionItem {
|
||||
|
@ -26,7 +26,7 @@ pub(crate) fn render_fn<'a>(
|
||||
pub(crate) fn render_method<'a>(
|
||||
ctx: RenderContext<'a>,
|
||||
import_to_add: Option<ImportEdit>,
|
||||
receiver: Option<String>,
|
||||
receiver: Option<hir::Name>,
|
||||
local_name: Option<hir::Name>,
|
||||
fn_: hir::Function,
|
||||
) -> Option<CompletionItem> {
|
||||
@ -38,7 +38,7 @@ pub(crate) fn render_method<'a>(
|
||||
struct FunctionRender<'a> {
|
||||
ctx: RenderContext<'a>,
|
||||
name: String,
|
||||
receiver: Option<String>,
|
||||
receiver: Option<hir::Name>,
|
||||
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<String>,
|
||||
receiver: Option<hir::Name>,
|
||||
local_name: Option<hir::Name>,
|
||||
fn_: hir::Function,
|
||||
is_method: bool,
|
||||
|
Loading…
Reference in New Issue
Block a user