We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent e53792b commit 08c44a6Copy full SHA for 08c44a6
crates/syntax/src/ast/node_ext.rs
@@ -289,8 +289,15 @@ impl ast::Path {
289
}
290
291
pub fn segments(&self) -> impl Iterator<Item = ast::PathSegment> + Clone {
292
- successors(self.first_segment(), |p| {
293
- p.parent_path().parent_path().and_then(|p| p.segment())
+ let path_range = self.syntax().text_range();
+ successors(self.first_segment(), move |p| {
294
+ p.parent_path().parent_path().and_then(|p| {
295
+ if path_range.contains_range(p.syntax().text_range()) {
296
+ p.segment()
297
+ } else {
298
+ None
299
+ }
300
+ })
301
})
302
303
0 commit comments