aboutsummaryrefslogtreecommitdiff
path: root/crates/ra_syntax/src
diff options
context:
space:
mode:
authorbors[bot] <bors[bot]@users.noreply.github.com>2018-11-07 18:39:33 +0000
committerbors[bot] <bors[bot]@users.noreply.github.com>2018-11-07 18:39:33 +0000
commit0952b928addce602bef9b671d7904033df39f632 (patch)
tree8951f181a563fbb08199ab99f383f2d01a756f05 /crates/ra_syntax/src
parent06fbc6e3edca1e53f1034bf779f2677d87076c1c (diff)
parent6d253b58da955cee73b0715b91d728df5009937d (diff)
Merge #217
217: Complete paths in use trees r=matklad a=matklad Co-authored-by: Aleksey Kladov <[email protected]>
Diffstat (limited to 'crates/ra_syntax/src')
-rw-r--r--crates/ra_syntax/src/ast/mod.rs9
1 files changed, 9 insertions, 0 deletions
diff --git a/crates/ra_syntax/src/ast/mod.rs b/crates/ra_syntax/src/ast/mod.rs
index d93f92672..6b0d62610 100644
--- a/crates/ra_syntax/src/ast/mod.rs
+++ b/crates/ra_syntax/src/ast/mod.rs
@@ -296,6 +296,15 @@ impl<'a> PathSegment<'a> {
296 } 296 }
297} 297}
298 298
299impl<'a> UseTreeList<'a> {
300 pub fn parent_use_tree(self) -> UseTree<'a> {
301 self.syntax()
302 .parent()
303 .and_then(UseTree::cast)
304 .expect("UseTreeLists are always nested in UseTrees")
305 }
306}
307
299fn child_opt<'a, P: AstNode<'a>, C: AstNode<'a>>(parent: P) -> Option<C> { 308fn child_opt<'a, P: AstNode<'a>, C: AstNode<'a>>(parent: P) -> Option<C> {
300 children(parent).next() 309 children(parent).next()
301} 310}