]> git.lizzy.rs Git - rust.git/commitdiff
NFC: remove redundant clones (clippy::perf)
authorMatthias Krüger <matthias.krueger@famsik.de>
Thu, 3 Jun 2021 13:32:46 +0000 (15:32 +0200)
committerMatthias Krüger <matthias.krueger@famsik.de>
Thu, 3 Jun 2021 13:32:46 +0000 (15:32 +0200)
crates/hir_def/src/item_tree/lower.rs
crates/ide_assists/src/handlers/extract_type_alias.rs
crates/ide_completion/src/context.rs
crates/proc_macro_api/src/msg.rs
crates/rust-analyzer/src/handlers.rs

index 0e467d907190a1b443ec9c084b31dbf2a91289fd..cfda7cb321cdb1a3afa21be139f5c840830b28a5 100644 (file)
@@ -130,7 +130,7 @@ fn lower_mod_item(&mut self, item: &ast::Item, inner: bool) -> Option<ModItem> {
             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)
     }
index 4bccf59847512e74ccb846c810f74dda28a25226..eac8857c6788b9421626a54c10f857b828782315 100644 (file)
@@ -31,7 +31,7 @@ pub(crate) fn extract_type_alias(acc: &mut Assists, ctx: &AssistContext) -> Opti
     let item = ctx.find_node_at_offset::<ast::Item>()?;
     let insert = match_ast! {
         match (item.syntax().parent()?) {
-            ast::AssocItemList(it) => it.syntax().parent()?.clone(),
+            ast::AssocItemList(it) => it.syntax().parent()?,
             _ => item.syntax().clone(),
         }
     };
index 6f685c02f3857514c089f09e9fc88ce8bc5f3d33..cb4f08e535c4234e9dcb67a3302dc30f65599ef8 100644 (file)
@@ -567,7 +567,7 @@ fn classify_name_ref(&mut self, original_file: &SyntaxNode, name_ref: ast::NameR
             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()
index f525df1525d5fd5740170698494f0f3d9d778cf8..14eed42890cafdebb8850c22f4eeea7268594f29 100644 (file)
@@ -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;
         }
index 4567446036e4d2e5048a6c9d276c70bae4d67559..49ee4b9224bb2d97ce5e0d0103e765141b12ecf4 100644 (file)
@@ -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;