aboutsummaryrefslogtreecommitdiff
path: root/crates/syntax/src/ast/node_ext.rs
diff options
context:
space:
mode:
Diffstat (limited to 'crates/syntax/src/ast/node_ext.rs')
-rw-r--r--crates/syntax/src/ast/node_ext.rs5
1 files changed, 4 insertions, 1 deletions
diff --git a/crates/syntax/src/ast/node_ext.rs b/crates/syntax/src/ast/node_ext.rs
index 884fe0739..a60bc5ad9 100644
--- a/crates/syntax/src/ast/node_ext.rs
+++ b/crates/syntax/src/ast/node_ext.rs
@@ -259,11 +259,14 @@ impl ast::Path {
259 } 259 }
260 260
261 pub fn segments(&self) -> impl Iterator<Item = ast::PathSegment> + Clone { 261 pub fn segments(&self) -> impl Iterator<Item = ast::PathSegment> + Clone {
262 // cant make use of SyntaxNode::siblings, because the returned Iterator is not clone
263 successors(self.first_segment(), |p| { 262 successors(self.first_segment(), |p| {
264 p.parent_path().parent_path().and_then(|p| p.segment()) 263 p.parent_path().parent_path().and_then(|p| p.segment())
265 }) 264 })
266 } 265 }
266
267 pub fn qualifiers(&self) -> impl Iterator<Item = ast::Path> + Clone {
268 successors(self.qualifier(), |p| p.qualifier())
269 }
267} 270}
268impl ast::UseTree { 271impl ast::UseTree {
269 pub fn is_simple_path(&self) -> bool { 272 pub fn is_simple_path(&self) -> bool {