Fix edge case for ImportGranularity guessing

This commit is contained in:
Lukas Wirth 2021-06-08 22:14:30 +02:00
parent 590472607c
commit 31aad2528f
3 changed files with 30 additions and 8 deletions

View file

@ -259,11 +259,14 @@ impl ast::Path {
}
pub fn segments(&self) -> impl Iterator<Item = ast::PathSegment> + 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<Item = ast::Path> + Clone {
successors(self.qualifier(), |p| p.qualifier())
}
}
impl ast::UseTree {
pub fn is_simple_path(&self) -> bool {