From 9452dfaac73cf1ad99e43795f3b1066e54e32abd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Matthias=20Kr=C3=BCger?= Date: Thu, 3 Jun 2021 15:32:46 +0200 Subject: NFC: remove redundant clones (clippy::perf) --- crates/hir_def/src/item_tree/lower.rs | 2 +- crates/ide_assists/src/handlers/extract_type_alias.rs | 2 +- crates/ide_completion/src/context.rs | 2 +- crates/proc_macro_api/src/msg.rs | 2 +- crates/rust-analyzer/src/handlers.rs | 2 +- 5 files changed, 5 insertions(+), 5 deletions(-) diff --git a/crates/hir_def/src/item_tree/lower.rs b/crates/hir_def/src/item_tree/lower.rs index 0e467d907..cfda7cb32 100644 --- a/crates/hir_def/src/item_tree/lower.rs +++ b/crates/hir_def/src/item_tree/lower.rs @@ -130,7 +130,7 @@ impl<'a> Ctx<'a> { ast::Item::ExternBlock(ast) => self.lower_extern_block(ast).into(), }; - self.add_attrs(item.into(), attrs.clone()); + self.add_attrs(item.into(), attrs); Some(item) } diff --git a/crates/ide_assists/src/handlers/extract_type_alias.rs b/crates/ide_assists/src/handlers/extract_type_alias.rs index 4bccf5984..eac8857c6 100644 --- a/crates/ide_assists/src/handlers/extract_type_alias.rs +++ b/crates/ide_assists/src/handlers/extract_type_alias.rs @@ -31,7 +31,7 @@ pub(crate) fn extract_type_alias(acc: &mut Assists, ctx: &AssistContext) -> Opti let item = ctx.find_node_at_offset::()?; let insert = match_ast! { match (item.syntax().parent()?) { - ast::AssocItemList(it) => it.syntax().parent()?.clone(), + ast::AssocItemList(it) => it.syntax().parent()?, _ => item.syntax().clone(), } }; diff --git a/crates/ide_completion/src/context.rs b/crates/ide_completion/src/context.rs index 6f685c02f..cb4f08e53 100644 --- a/crates/ide_completion/src/context.rs +++ b/crates/ide_completion/src/context.rs @@ -567,7 +567,7 @@ impl<'a> CompletionContext<'a> { None => return, }; - if let Some(segment) = ast::PathSegment::cast(parent.clone()) { + if let Some(segment) = ast::PathSegment::cast(parent) { let path = segment.parent_path(); self.is_call = path .syntax() diff --git a/crates/proc_macro_api/src/msg.rs b/crates/proc_macro_api/src/msg.rs index f525df152..14eed4289 100644 --- a/crates/proc_macro_api/src/msg.rs +++ b/crates/proc_macro_api/src/msg.rs @@ -92,7 +92,7 @@ fn read_json<'a>( // Some ill behaved macro try to use stdout for debugging // We ignore it here - if !buf.starts_with("{") { + if !buf.starts_with('{') { log::error!("proc-macro tried to print : {}", buf); continue; } diff --git a/crates/rust-analyzer/src/handlers.rs b/crates/rust-analyzer/src/handlers.rs index 456744603..49ee4b922 100644 --- a/crates/rust-analyzer/src/handlers.rs +++ b/crates/rust-analyzer/src/handlers.rs @@ -1640,7 +1640,7 @@ fn run_rustfmt( .into()); } - let frange = from_proto::file_range(&snap, text_document.clone(), range)?; + let frange = from_proto::file_range(&snap, text_document, range)?; let start_line = line_index.index.line_col(frange.range.start()).line; let end_line = line_index.index.line_col(frange.range.end()).line; -- cgit v1.2.3