aboutsummaryrefslogtreecommitdiff
path: root/crates/syntax/src
diff options
context:
space:
mode:
authorJeremy Kolb <[email protected]>2020-12-12 17:27:09 +0000
committerJeremy Kolb <[email protected]>2020-12-12 17:27:09 +0000
commit26a1675764c9f96cc96d75d2129dd6c828b8df51 (patch)
treee53212d4569e73c7337bb205e937174f425fda5b /crates/syntax/src
parent479d1f7eec22c3564867223e2093f14774092528 (diff)
Remove some redundant allocations
Diffstat (limited to 'crates/syntax/src')
-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 };