mirror of
https://github.com/rust-lang/rust.git
synced 2026-05-31 13:40:15 +03:00
Simplify API
This commit is contained in:
@@ -43,10 +43,6 @@ pub fn children(&self) -> &[GreenNode] {
|
||||
}
|
||||
}
|
||||
|
||||
pub fn leaf_text(&self) -> Option<SmolStr> {
|
||||
self.leaf_text_ref().map(Clone::clone)
|
||||
}
|
||||
|
||||
pub fn leaf_text_ref(&self) -> Option<&SmolStr> {
|
||||
match self {
|
||||
GreenNode::Leaf { text, .. } => Some(text),
|
||||
|
||||
@@ -153,7 +153,7 @@ pub fn is_leaf(&self) -> bool {
|
||||
}
|
||||
|
||||
pub fn leaf_text(&self) -> Option<SmolStr> {
|
||||
self.red().green().leaf_text()
|
||||
self.borrowed().leaf_text_ref().map(|it| it.clone())
|
||||
}
|
||||
|
||||
pub(crate) fn replace_with(&self, green: GreenNode) -> GreenNode {
|
||||
|
||||
Reference in New Issue
Block a user