From 966c23f5290275ce17564f6027a17ec20cd6078f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Matthias=20Kr=C3=BCger?= Date: Wed, 17 Mar 2021 01:27:56 +0100 Subject: avoid converting types into themselves via .into() (clippy::useless-conversion) example: let x: String = String::from("hello world").into(); --- crates/ide_completion/src/completions.rs | 2 +- crates/ide_completion/src/completions/postfix/format_like.rs | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) (limited to 'crates/ide_completion/src') diff --git a/crates/ide_completion/src/completions.rs b/crates/ide_completion/src/completions.rs index 3b582ed07..09882c4f3 100644 --- a/crates/ide_completion/src/completions.rs +++ b/crates/ide_completion/src/completions.rs @@ -56,7 +56,7 @@ impl Builder { impl Completions { pub(crate) fn add(&mut self, item: CompletionItem) { - self.buf.push(item.into()) + self.buf.push(item) } pub(crate) fn add_all(&mut self, items: I) diff --git a/crates/ide_completion/src/completions/postfix/format_like.rs b/crates/ide_completion/src/completions/postfix/format_like.rs index cee4eec10..3f1c6730b 100644 --- a/crates/ide_completion/src/completions/postfix/format_like.rs +++ b/crates/ide_completion/src/completions/postfix/format_like.rs @@ -89,7 +89,7 @@ enum State { impl FormatStrParser { pub(crate) fn new(input: String) -> Self { Self { - input: input.into(), + input: input, output: String::new(), extracted_expressions: Vec::new(), state: State::NotExpr, -- cgit v1.2.3 From 048dad8c2e86006e53b3a134279729efb28b9e32 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Matthias=20Kr=C3=BCger?= Date: Wed, 17 Mar 2021 01:56:31 +0100 Subject: don't clone types that are copy (clippy::clone_on_copy) --- crates/ide_completion/src/completions/pattern.rs | 4 ++-- crates/ide_completion/src/render.rs | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) (limited to 'crates/ide_completion/src') diff --git a/crates/ide_completion/src/completions/pattern.rs b/crates/ide_completion/src/completions/pattern.rs index 46cef58f0..476eecff0 100644 --- a/crates/ide_completion/src/completions/pattern.rs +++ b/crates/ide_completion/src/completions/pattern.rs @@ -26,11 +26,11 @@ pub(crate) fn complete_pattern(acc: &mut Completions, ctx: &CompletionContext) { let add_resolution = match &res { hir::ScopeDef::ModuleDef(def) => match def { hir::ModuleDef::Adt(hir::Adt::Struct(strukt)) => { - acc.add_struct_pat(ctx, strukt.clone(), Some(name.clone())); + acc.add_struct_pat(ctx, *strukt, Some(name.clone())); true } hir::ModuleDef::Variant(variant) if !ctx.is_irrefutable_pat_binding => { - acc.add_variant_pat(ctx, variant.clone(), Some(name.clone())); + acc.add_variant_pat(ctx, *variant, Some(name.clone())); true } hir::ModuleDef::Adt(hir::Adt::Enum(..)) diff --git a/crates/ide_completion/src/render.rs b/crates/ide_completion/src/render.rs index 4e4923e0d..12921e12b 100644 --- a/crates/ide_completion/src/render.rs +++ b/crates/ide_completion/src/render.rs @@ -81,7 +81,7 @@ impl<'a> RenderContext<'a> { } fn snippet_cap(&self) -> Option { - self.completion.config.snippet_cap.clone() + self.completion.config.snippet_cap } fn db(&self) -> &'a RootDatabase { -- cgit v1.2.3