aboutsummaryrefslogtreecommitdiff
path: root/src/yellow
diff options
context:
space:
mode:
authorAleksey Kladov <[email protected]>2018-08-08 18:25:35 +0100
committerAleksey Kladov <[email protected]>2018-08-08 18:25:35 +0100
commit1fa5b2ffbc0f1dd3cfc45adff0329e1bdd46c131 (patch)
tree5ebfc103a7d5c69705fdfc1166dbf60e61a9e441 /src/yellow
parentcc4c90aa2cf4da819dd324a7bbf8b36f6a068a6d (diff)
smol strings
Diffstat (limited to 'src/yellow')
-rw-r--r--src/yellow/green.rs7
1 files changed, 4 insertions, 3 deletions
diff --git a/src/yellow/green.rs b/src/yellow/green.rs
index 3ade46f45..26df76af6 100644
--- a/src/yellow/green.rs
+++ b/src/yellow/green.rs
@@ -1,5 +1,6 @@
1use std::sync::Arc; 1use std::sync::Arc;
2use { 2use {
3 smol_str::SmolStr,
3 SyntaxKind::{self, *}, 4 SyntaxKind::{self, *},
4 TextUnit, 5 TextUnit,
5}; 6};
@@ -116,7 +117,7 @@ pub(crate) enum GreenLeaf {
116 }, 117 },
117 Token { 118 Token {
118 kind: SyntaxKind, 119 kind: SyntaxKind,
119 text: Option<Arc<str>>, 120 text: Option<SmolStr>,
120 }, 121 },
121} 122}
122 123
@@ -137,7 +138,7 @@ impl GreenLeaf {
137 debug_assert_eq!(t, text); 138 debug_assert_eq!(t, text);
138 None 139 None
139 } 140 }
140 None => Some(text.to_owned().into_boxed_str().into()), 141 None => Some(SmolStr::new(text)),
141 }; 142 };
142 GreenLeaf::Token { kind, text } 143 GreenLeaf::Token { kind, text }
143 } 144 }
@@ -159,7 +160,7 @@ impl GreenLeaf {
159 } 160 }
160 GreenLeaf::Token { kind, text } => match text { 161 GreenLeaf::Token { kind, text } => match text {
161 None => kind.static_text().unwrap(), 162 None => kind.static_text().unwrap(),
162 Some(t) => t, 163 Some(t) => t.as_str(),
163 }, 164 },
164 } 165 }
165 } 166 }