mirror of
https://github.com/rust-lang/rust-analyzer.git
synced 2025-10-01 14:21:44 +00:00
Less strings, more hir::Names
This commit is contained in:
parent
ca49fbe0a1
commit
d346f5bf75
4 changed files with 13 additions and 13 deletions
|
@ -74,7 +74,7 @@ impl Completions {
|
||||||
pub(crate) fn add_field(
|
pub(crate) fn add_field(
|
||||||
&mut self,
|
&mut self,
|
||||||
ctx: &CompletionContext,
|
ctx: &CompletionContext,
|
||||||
receiver: Option<String>,
|
receiver: Option<hir::Name>,
|
||||||
field: hir::Field,
|
field: hir::Field,
|
||||||
ty: &hir::Type,
|
ty: &hir::Type,
|
||||||
) {
|
) {
|
||||||
|
@ -85,7 +85,7 @@ impl Completions {
|
||||||
pub(crate) fn add_tuple_field(
|
pub(crate) fn add_tuple_field(
|
||||||
&mut self,
|
&mut self,
|
||||||
ctx: &CompletionContext,
|
ctx: &CompletionContext,
|
||||||
receiver: Option<String>,
|
receiver: Option<hir::Name>,
|
||||||
field: usize,
|
field: usize,
|
||||||
ty: &hir::Type,
|
ty: &hir::Type,
|
||||||
) {
|
) {
|
||||||
|
@ -141,7 +141,7 @@ impl Completions {
|
||||||
&mut self,
|
&mut self,
|
||||||
ctx: &CompletionContext,
|
ctx: &CompletionContext,
|
||||||
func: hir::Function,
|
func: hir::Function,
|
||||||
receiver: Option<String>,
|
receiver: Option<hir::Name>,
|
||||||
local_name: Option<hir::Name>,
|
local_name: Option<hir::Name>,
|
||||||
) {
|
) {
|
||||||
if let Some(item) = render_method(RenderContext::new(ctx), None, receiver, local_name, func)
|
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);
|
let ty = local.ty(ctx.db);
|
||||||
super::complete_fields(ctx, &ty, |field, ty| match field {
|
super::complete_fields(ctx, &ty, |field, ty| match field {
|
||||||
either::Either::Left(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) => {
|
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| {
|
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 @@ use crate::{
|
||||||
|
|
||||||
pub(crate) fn render_field<'a>(
|
pub(crate) fn render_field<'a>(
|
||||||
ctx: RenderContext<'a>,
|
ctx: RenderContext<'a>,
|
||||||
receiver: Option<String>,
|
receiver: Option<hir::Name>,
|
||||||
field: hir::Field,
|
field: hir::Field,
|
||||||
ty: &hir::Type,
|
ty: &hir::Type,
|
||||||
) -> CompletionItem {
|
) -> CompletionItem {
|
||||||
|
@ -34,7 +34,7 @@ pub(crate) fn render_field<'a>(
|
||||||
|
|
||||||
pub(crate) fn render_tuple_field<'a>(
|
pub(crate) fn render_tuple_field<'a>(
|
||||||
ctx: RenderContext<'a>,
|
ctx: RenderContext<'a>,
|
||||||
receiver: Option<String>,
|
receiver: Option<hir::Name>,
|
||||||
field: usize,
|
field: usize,
|
||||||
ty: &hir::Type,
|
ty: &hir::Type,
|
||||||
) -> CompletionItem {
|
) -> CompletionItem {
|
||||||
|
@ -130,7 +130,7 @@ impl<'a> Render<'a> {
|
||||||
|
|
||||||
fn render_field(
|
fn render_field(
|
||||||
&self,
|
&self,
|
||||||
receiver: Option<String>,
|
receiver: Option<hir::Name>,
|
||||||
field: hir::Field,
|
field: hir::Field,
|
||||||
ty: &hir::Type,
|
ty: &hir::Type,
|
||||||
) -> CompletionItem {
|
) -> CompletionItem {
|
||||||
|
@ -163,7 +163,7 @@ impl<'a> Render<'a> {
|
||||||
|
|
||||||
fn render_tuple_field(
|
fn render_tuple_field(
|
||||||
&self,
|
&self,
|
||||||
receiver: Option<String>,
|
receiver: Option<hir::Name>,
|
||||||
field: usize,
|
field: usize,
|
||||||
ty: &hir::Type,
|
ty: &hir::Type,
|
||||||
) -> CompletionItem {
|
) -> CompletionItem {
|
||||||
|
|
|
@ -26,7 +26,7 @@ pub(crate) fn render_fn<'a>(
|
||||||
pub(crate) fn render_method<'a>(
|
pub(crate) fn render_method<'a>(
|
||||||
ctx: RenderContext<'a>,
|
ctx: RenderContext<'a>,
|
||||||
import_to_add: Option<ImportEdit>,
|
import_to_add: Option<ImportEdit>,
|
||||||
receiver: Option<String>,
|
receiver: Option<hir::Name>,
|
||||||
local_name: Option<hir::Name>,
|
local_name: Option<hir::Name>,
|
||||||
fn_: hir::Function,
|
fn_: hir::Function,
|
||||||
) -> Option<CompletionItem> {
|
) -> Option<CompletionItem> {
|
||||||
|
@ -38,7 +38,7 @@ pub(crate) fn render_method<'a>(
|
||||||
struct FunctionRender<'a> {
|
struct FunctionRender<'a> {
|
||||||
ctx: RenderContext<'a>,
|
ctx: RenderContext<'a>,
|
||||||
name: String,
|
name: String,
|
||||||
receiver: Option<String>,
|
receiver: Option<hir::Name>,
|
||||||
func: hir::Function,
|
func: hir::Function,
|
||||||
ast_node: Fn,
|
ast_node: Fn,
|
||||||
is_method: bool,
|
is_method: bool,
|
||||||
|
@ -47,7 +47,7 @@ struct FunctionRender<'a> {
|
||||||
impl<'a> FunctionRender<'a> {
|
impl<'a> FunctionRender<'a> {
|
||||||
fn new(
|
fn new(
|
||||||
ctx: RenderContext<'a>,
|
ctx: RenderContext<'a>,
|
||||||
receiver: Option<String>,
|
receiver: Option<hir::Name>,
|
||||||
local_name: Option<hir::Name>,
|
local_name: Option<hir::Name>,
|
||||||
fn_: hir::Function,
|
fn_: hir::Function,
|
||||||
is_method: bool,
|
is_method: bool,
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue