diff options
author | Aleksey Kladov <[email protected]> | 2018-08-13 12:24:22 +0100 |
---|---|---|
committer | Aleksey Kladov <[email protected]> | 2018-08-13 12:24:22 +0100 |
commit | ed2ac1713326df6b926062efcc6109a20cdf7c37 (patch) | |
tree | c1c75d09e2adbbd54190c5b6ce6efdb7ea251da3 /crates/libsyntax2/src/ast | |
parent | 18486a02fae5966e61f16ea7bc5c33c6c7c69487 (diff) |
smol_str to a crate
Diffstat (limited to 'crates/libsyntax2/src/ast')
-rw-r--r-- | crates/libsyntax2/src/ast/mod.rs | 9 |
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 @@ | |||
1 | mod generated; | 1 | mod generated; |
2 | 2 | ||
3 | use std::sync::Arc; | 3 | use std::sync::Arc; |
4 | |||
5 | use smol_str::SmolStr; | ||
6 | |||
4 | use { | 7 | use { |
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 | ||
66 | impl<R: TreeRoot> Name<R> { | 69 | impl<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 | } |