diff options
author | bors[bot] <bors[bot]@users.noreply.github.com> | 2019-01-05 10:57:39 +0000 |
---|---|---|
committer | bors[bot] <bors[bot]@users.noreply.github.com> | 2019-01-05 10:57:39 +0000 |
commit | 9b5b13dfcfe32bccbf3593eee26bf88a5fd60413 (patch) | |
tree | 6e9822bea3fbda059fa02661f6e6137770885520 /crates/ra_syntax | |
parent | 481713a0e17e1557288e88a6b1a173b111792998 (diff) | |
parent | ea3504057e73f541af64451a1b5d2c691d5c01bc (diff) |
Merge #430
430: split import assist r=matklad a=matklad
Co-authored-by: Aleksey Kladov <[email protected]>
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) |