.
This commit is contained in:
@@ -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<SmolStr> {
|
||||
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,
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user