Or, maybe:

```rust
let mut segments = vec![];
for (seg, span) in path.segments.iter().zip(spans.iter()) {
    segments.push(seg.clone());
    let sub_path = ast::Path { span: span, global: path.global, segments: segments };
    /// ...
    
    segments = sub_path.segments
}
```
which (theoretically) avoids the O(n^2) cloning that this does. (Although it like doesn't matter at all.)