aboutsummaryrefslogtreecommitdiff
path: root/crates/syntax
diff options
context:
space:
mode:
authorbors[bot] <26634292+bors[bot]@users.noreply.github.com>2021-06-08 21:18:54 +0100
committerGitHub <[email protected]>2021-06-08 21:18:54 +0100
commitf1a40f9093798efda0eb9b09a8dcb3d26410faf4 (patch)
tree4a537c51d629873a8c83950377ea3a44baf3da7c /crates/syntax
parentb6199de706868dcbf57d9821829381609212d851 (diff)
parent31aad2528f53349e9a0601c756d3c9f86ca9154c (diff)
Merge #9187
9187: fix: Fix edge case for ImportGranularity guessing r=Veykril a=Veykril bors r+ Co-authored-by: Lukas Wirth <[email protected]>
Diffstat (limited to 'crates/syntax')
-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 {