From 31aad2528f53349e9a0601c756d3c9f86ca9154c Mon Sep 17 00:00:00 2001 From: Lukas Wirth Date: Tue, 8 Jun 2021 22:14:30 +0200 Subject: Fix edge case for ImportGranularity guessing --- crates/syntax/src/ast/node_ext.rs | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'crates/syntax') 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 { } pub fn segments(&self) -> impl Iterator + Clone { - // cant make use of SyntaxNode::siblings, because the returned Iterator is not clone successors(self.first_segment(), |p| { p.parent_path().parent_path().and_then(|p| p.segment()) }) } + + pub fn qualifiers(&self) -> impl Iterator + Clone { + successors(self.qualifier(), |p| p.qualifier()) + } } impl ast::UseTree { pub fn is_simple_path(&self) -> bool { -- cgit v1.2.3