From 133b4063a696ab9fbf350b2235c006bdd623b136 Mon Sep 17 00:00:00 2001 From: kjeremy Date: Fri, 20 Dec 2019 09:43:01 -0500 Subject: [PATCH 1/2] Remove useless clone --- crates/ra_hir_expand/src/builtin_macro.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/crates/ra_hir_expand/src/builtin_macro.rs b/crates/ra_hir_expand/src/builtin_macro.rs index d2b3d769e8..1749b491b9 100644 --- a/crates/ra_hir_expand/src/builtin_macro.rs +++ b/crates/ra_hir_expand/src/builtin_macro.rs @@ -108,7 +108,7 @@ fn stringify_expand( let macro_content = { let arg = loc.kind.arg(db).ok_or_else(|| mbe::ExpandError::UnexpectedToken)?; - let macro_args = arg.clone(); + let macro_args = arg; let text = macro_args.text(); let without_parens = TextUnit::of_char('(')..text.len() - TextUnit::of_char(')'); text.slice(without_parens).to_string() From f22aabc1360eb7e900a4495bc68f3302c7c49a7c Mon Sep 17 00:00:00 2001 From: kjeremy Date: Fri, 20 Dec 2019 09:43:30 -0500 Subject: [PATCH 2/2] Use unwrap_or_default --- crates/ra_syntax/src/ast/edit.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/crates/ra_syntax/src/ast/edit.rs b/crates/ra_syntax/src/ast/edit.rs index 95bf9db147..ae5d639276 100644 --- a/crates/ra_syntax/src/ast/edit.rs +++ b/crates/ra_syntax/src/ast/edit.rs @@ -104,7 +104,7 @@ impl ast::ItemList { } }; - let indent = leading_indent(self.syntax()).unwrap_or("".into()); + let indent = leading_indent(self.syntax()).unwrap_or_default(); let ws = tokens::WsBuilder::new(&format!("\n{}", indent)); let to_insert = iter::once(ws.ws().into()); match existing_ws { @@ -133,7 +133,7 @@ impl ast::RecordFieldList { let space = if is_multiline { ws = tokens::WsBuilder::new(&format!( "\n{} ", - leading_indent(self.syntax()).unwrap_or("".into()) + leading_indent(self.syntax()).unwrap_or_default() )); ws.ws() } else {