aboutsummaryrefslogtreecommitdiff
path: root/crates/syntax/src/ast
diff options
context:
space:
mode:
authorbors[bot] <26634292+bors[bot]@users.noreply.github.com>2020-12-12 17:29:20 +0000
committerGitHub <[email protected]>2020-12-12 17:29:20 +0000
commit10f633283180d513138d0d969eceba96e3ce9f96 (patch)
treee53212d4569e73c7337bb205e937174f425fda5b /crates/syntax/src/ast
parent479d1f7eec22c3564867223e2093f14774092528 (diff)
parent26a1675764c9f96cc96d75d2129dd6c828b8df51 (diff)
Merge #6846
6846: Remove some redundant allocations r=kjeremy a=kjeremy Co-authored-by: Jeremy Kolb <[email protected]>
Diffstat (limited to 'crates/syntax/src/ast')
-rw-r--r--crates/syntax/src/ast/node_ext.rs2
-rw-r--r--crates/syntax/src/ast/token_ext.rs2
2 files changed, 2 insertions, 2 deletions
diff --git a/crates/syntax/src/ast/node_ext.rs b/crates/syntax/src/ast/node_ext.rs
index aa3a4b606..820af2d20 100644
--- a/crates/syntax/src/ast/node_ext.rs
+++ b/crates/syntax/src/ast/node_ext.rs
@@ -55,7 +55,7 @@ impl ast::Attr {
55 let key = self.simple_name()?; 55 let key = self.simple_name()?;
56 let value_token = lit.syntax().first_token()?; 56 let value_token = lit.syntax().first_token()?;
57 57
58 let value: SmolStr = ast::String::cast(value_token.clone())?.value()?.into(); 58 let value: SmolStr = ast::String::cast(value_token)?.value()?.into();
59 59
60 Some((key, value)) 60 Some((key, value))
61 } 61 }
diff --git a/crates/syntax/src/ast/token_ext.rs b/crates/syntax/src/ast/token_ext.rs
index 52b7285dd..5e9620a40 100644
--- a/crates/syntax/src/ast/token_ext.rs
+++ b/crates/syntax/src/ast/token_ext.rs
@@ -599,7 +599,7 @@ impl ast::IntNumber {
599 text = &text[radix.prefix_len()..]; 599 text = &text[radix.prefix_len()..];
600 600
601 let buf; 601 let buf;
602 if text.contains("_") { 602 if text.contains('_') {
603 buf = text.replace('_', ""); 603 buf = text.replace('_', "");
604 text = buf.as_str(); 604 text = buf.as_str();
605 }; 605 };