From 46b4f89c920c314caf1a8af2abdb09732d100d67 Mon Sep 17 00:00:00 2001 From: Aleksey Kladov Date: Wed, 20 Jan 2021 01:56:11 +0300 Subject: . --- crates/syntax/src/ast/node_ext.rs | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'crates/syntax/src/ast/node_ext.rs') diff --git a/crates/syntax/src/ast/node_ext.rs b/crates/syntax/src/ast/node_ext.rs index 738c92a5b..5c8cf900f 100644 --- a/crates/syntax/src/ast/node_ext.rs +++ b/crates/syntax/src/ast/node_ext.rs @@ -13,19 +13,19 @@ use crate::{ }; impl ast::Lifetime { - pub fn text(&self) -> &SmolStr { + pub fn text(&self) -> &str { text_of_first_token(self.syntax()) } } impl ast::Name { - pub fn text(&self) -> &SmolStr { + pub fn text(&self) -> &str { text_of_first_token(self.syntax()) } } impl ast::NameRef { - pub fn text(&self) -> &SmolStr { + pub fn text(&self) -> &str { text_of_first_token(self.syntax()) } @@ -34,7 +34,7 @@ impl ast::NameRef { } } -fn text_of_first_token(node: &SyntaxNode) -> &SmolStr { +fn text_of_first_token(node: &SyntaxNode) -> &str { node.green().children().next().and_then(|it| it.into_token()).unwrap().text() } @@ -121,7 +121,7 @@ impl ast::Attr { pub fn simple_name(&self) -> Option { let path = self.path()?; match (path.segment(), path.qualifier()) { - (Some(segment), None) => Some(segment.syntax().first_token()?.text().clone()), + (Some(segment), None) => Some(segment.syntax().first_token()?.text().into()), _ => None, } } -- cgit v1.2.3