mirror of
https://github.com/rust-lang/rust-analyzer.git
synced 2025-09-29 13:25:09 +00:00
Fix some clippy lints in ide_completion
This commit is contained in:
parent
ccde0bcd1f
commit
9485d6efba
10 changed files with 34 additions and 41 deletions
|
@ -12,10 +12,7 @@ use crate::{
|
|||
render::RenderContext,
|
||||
};
|
||||
|
||||
pub(crate) fn render_const<'a>(
|
||||
ctx: RenderContext<'a>,
|
||||
const_: hir::Const,
|
||||
) -> Option<CompletionItem> {
|
||||
pub(crate) fn render_const(ctx: RenderContext<'_>, const_: hir::Const) -> Option<CompletionItem> {
|
||||
ConstRender::new(ctx, const_)?.render()
|
||||
}
|
||||
|
||||
|
@ -50,7 +47,7 @@ impl<'a> ConstRender<'a> {
|
|||
if let Some(actm) = self.const_.as_assoc_item(db) {
|
||||
if let Some(trt) = actm.containing_trait_or_trait_impl(db) {
|
||||
item.trait_name(trt.name(db).to_string());
|
||||
item.insert_text(name.clone());
|
||||
item.insert_text(name);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -12,8 +12,8 @@ use crate::{
|
|||
CompletionRelevance,
|
||||
};
|
||||
|
||||
pub(crate) fn render_variant<'a>(
|
||||
ctx: RenderContext<'a>,
|
||||
pub(crate) fn render_variant(
|
||||
ctx: RenderContext<'_>,
|
||||
import_to_add: Option<ImportEdit>,
|
||||
local_name: Option<hir::Name>,
|
||||
variant: hir::Variant,
|
||||
|
|
|
@ -13,8 +13,8 @@ use crate::{
|
|||
},
|
||||
};
|
||||
|
||||
pub(crate) fn render_fn<'a>(
|
||||
ctx: RenderContext<'a>,
|
||||
pub(crate) fn render_fn(
|
||||
ctx: RenderContext<'_>,
|
||||
import_to_add: Option<ImportEdit>,
|
||||
local_name: Option<hir::Name>,
|
||||
fn_: hir::Function,
|
||||
|
@ -23,8 +23,8 @@ pub(crate) fn render_fn<'a>(
|
|||
Some(FunctionRender::new(ctx, None, local_name, fn_, false)?.render(import_to_add))
|
||||
}
|
||||
|
||||
pub(crate) fn render_method<'a>(
|
||||
ctx: RenderContext<'a>,
|
||||
pub(crate) fn render_method(
|
||||
ctx: RenderContext<'_>,
|
||||
import_to_add: Option<ImportEdit>,
|
||||
receiver: Option<hir::Name>,
|
||||
local_name: Option<hir::Name>,
|
||||
|
|
|
@ -10,8 +10,8 @@ use crate::{
|
|||
render::RenderContext,
|
||||
};
|
||||
|
||||
pub(crate) fn render_macro<'a>(
|
||||
ctx: RenderContext<'a>,
|
||||
pub(crate) fn render_macro(
|
||||
ctx: RenderContext<'_>,
|
||||
import_to_add: Option<ImportEdit>,
|
||||
name: hir::Name,
|
||||
macro_: hir::MacroDef,
|
||||
|
@ -76,12 +76,10 @@ impl<'a> MacroRender<'a> {
|
|||
fn label(&self) -> String {
|
||||
if self.needs_bang() && self.ctx.snippet_cap().is_some() {
|
||||
format!("{}!{}…{}", self.name, self.bra, self.ket)
|
||||
} else if self.macro_.kind() == hir::MacroKind::Derive {
|
||||
self.name.to_string()
|
||||
} else {
|
||||
if self.macro_.kind() == hir::MacroKind::Derive {
|
||||
self.name.to_string()
|
||||
} else {
|
||||
self.banged_name()
|
||||
}
|
||||
self.banged_name()
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -139,7 +139,7 @@ fn visible_fields(
|
|||
let module = ctx.completion.scope.module()?;
|
||||
let n_fields = fields.len();
|
||||
let fields = fields
|
||||
.into_iter()
|
||||
.iter()
|
||||
.filter(|field| field.is_visible_from(ctx.db(), module))
|
||||
.copied()
|
||||
.collect::<Vec<_>>();
|
||||
|
|
|
@ -12,15 +12,15 @@ use crate::{
|
|||
render::RenderContext,
|
||||
};
|
||||
|
||||
pub(crate) fn render_type_alias<'a>(
|
||||
ctx: RenderContext<'a>,
|
||||
pub(crate) fn render_type_alias(
|
||||
ctx: RenderContext<'_>,
|
||||
type_alias: hir::TypeAlias,
|
||||
) -> Option<CompletionItem> {
|
||||
TypeAliasRender::new(ctx, type_alias)?.render(false)
|
||||
}
|
||||
|
||||
pub(crate) fn render_type_alias_with_eq<'a>(
|
||||
ctx: RenderContext<'a>,
|
||||
pub(crate) fn render_type_alias_with_eq(
|
||||
ctx: RenderContext<'_>,
|
||||
type_alias: hir::TypeAlias,
|
||||
) -> Option<CompletionItem> {
|
||||
TypeAliasRender::new(ctx, type_alias)?.render(true)
|
||||
|
@ -63,7 +63,7 @@ impl<'a> TypeAliasRender<'a> {
|
|||
if let Some(actm) = self.type_alias.as_assoc_item(db) {
|
||||
if let Some(trt) = actm.containing_trait_or_trait_impl(db) {
|
||||
item.trait_name(trt.name(db).to_string());
|
||||
item.insert_text(name.clone());
|
||||
item.insert_text(name);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue