diff options
Diffstat (limited to 'crates/ra_syntax')
-rw-r--r-- | crates/ra_syntax/src/ast.rs | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/crates/ra_syntax/src/ast.rs b/crates/ra_syntax/src/ast.rs index 2a3bd27e2..c10169d90 100644 --- a/crates/ra_syntax/src/ast.rs +++ b/crates/ra_syntax/src/ast.rs | |||
@@ -363,6 +363,12 @@ impl<'a> PathSegment<'a> { | |||
363 | } | 363 | } |
364 | } | 364 | } |
365 | 365 | ||
366 | impl<'a> Path<'a> { | ||
367 | pub fn parent_path(self) -> Option<Path<'a>> { | ||
368 | self.syntax().parent().and_then(Path::cast) | ||
369 | } | ||
370 | } | ||
371 | |||
366 | impl<'a> UseTree<'a> { | 372 | impl<'a> UseTree<'a> { |
367 | pub fn has_star(self) -> bool { | 373 | pub fn has_star(self) -> bool { |
368 | self.syntax().children().any(|it| it.kind() == STAR) | 374 | self.syntax().children().any(|it| it.kind() == STAR) |