aboutsummaryrefslogtreecommitdiff
path: root/crates/libsyntax2/src/ast
diff options
context:
space:
mode:
authorAleksey Kladov <[email protected]>2018-08-13 12:24:22 +0100
committerAleksey Kladov <[email protected]>2018-08-13 12:24:22 +0100
commited2ac1713326df6b926062efcc6109a20cdf7c37 (patch)
treec1c75d09e2adbbd54190c5b6ce6efdb7ea251da3 /crates/libsyntax2/src/ast
parent18486a02fae5966e61f16ea7bc5c33c6c7c69487 (diff)
smol_str to a crate
Diffstat (limited to 'crates/libsyntax2/src/ast')
-rw-r--r--crates/libsyntax2/src/ast/mod.rs9
1 files changed, 7 insertions, 2 deletions
diff --git a/crates/libsyntax2/src/ast/mod.rs b/crates/libsyntax2/src/ast/mod.rs
index 56bc099fe..e9362d048 100644
--- a/crates/libsyntax2/src/ast/mod.rs
+++ b/crates/libsyntax2/src/ast/mod.rs
@@ -1,6 +1,9 @@
1mod generated; 1mod generated;
2 2
3use std::sync::Arc; 3use std::sync::Arc;
4
5use smol_str::SmolStr;
6
4use { 7use {
5 SyntaxNode, SyntaxRoot, TreeRoot, SyntaxError, 8 SyntaxNode, SyntaxRoot, TreeRoot, SyntaxError,
6 SyntaxKind::*, 9 SyntaxKind::*,
@@ -64,7 +67,9 @@ impl<R: TreeRoot> Function<R> {
64} 67}
65 68
66impl<R: TreeRoot> Name<R> { 69impl<R: TreeRoot> Name<R> {
67 pub fn text(&self) -> String { 70 pub fn text(&self) -> SmolStr {
68 self.syntax().text() 71 let ident = self.syntax().first_child()
72 .unwrap();
73 ident.leaf_text().unwrap()
69 } 74 }
70} 75}