aboutsummaryrefslogtreecommitdiff
path: root/crates/syntax
diff options
context:
space:
mode:
authorLukas Wirth <[email protected]>2021-06-08 21:14:30 +0100
committerLukas Wirth <[email protected]>2021-06-08 21:14:30 +0100
commit31aad2528f53349e9a0601c756d3c9f86ca9154c (patch)
treed2250c8e6ccb80eb236e1731db9f4e5c80e48e54 /crates/syntax
parent590472607c9629fdd37e3f6f33dacfdc2a3f56cc (diff)
Fix edge case for ImportGranularity guessing
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 {