diff options
author | bors[bot] <26634292+bors[bot]@users.noreply.github.com> | 2021-06-08 21:18:54 +0100 |
---|---|---|
committer | GitHub <[email protected]> | 2021-06-08 21:18:54 +0100 |
commit | f1a40f9093798efda0eb9b09a8dcb3d26410faf4 (patch) | |
tree | 4a537c51d629873a8c83950377ea3a44baf3da7c /crates/syntax | |
parent | b6199de706868dcbf57d9821829381609212d851 (diff) | |
parent | 31aad2528f53349e9a0601c756d3c9f86ca9154c (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.rs | 5 |
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 | } |
268 | impl ast::UseTree { | 271 | impl ast::UseTree { |
269 | pub fn is_simple_path(&self) -> bool { | 272 | pub fn is_simple_path(&self) -> bool { |