From ed2ac1713326df6b926062efcc6109a20cdf7c37 Mon Sep 17 00:00:00 2001 From: Aleksey Kladov Date: Mon, 13 Aug 2018 14:24:22 +0300 Subject: smol_str to a crate --- crates/libsyntax2/src/ast/mod.rs | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) (limited to 'crates/libsyntax2/src/ast') 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 @@ mod generated; use std::sync::Arc; + +use smol_str::SmolStr; + use { SyntaxNode, SyntaxRoot, TreeRoot, SyntaxError, SyntaxKind::*, @@ -64,7 +67,9 @@ impl Function { } impl Name { - pub fn text(&self) -> String { - self.syntax().text() + pub fn text(&self) -> SmolStr { + let ident = self.syntax().first_child() + .unwrap(); + ident.leaf_text().unwrap() } } -- cgit v1.2.3