Use new iteration helpers instead of manually rolling them

This commit is contained in:
Oli Scherer 2023-03-15 15:44:23 +00:00
parent a1d20cf7a2
commit 300901b705

View File

@ -330,10 +330,7 @@ pub fn save_proc_macro_span(&self, span: Span) -> usize {
pub fn proc_macro_quoted_spans(&self) -> impl Iterator<Item = (usize, Span)> + '_ {
// This is equivalent to `.iter().copied().enumerate()`, but that isn't possible for
// AppendOnlyVec, so we resort to this scheme.
(0..)
.map(|i| (i, self.proc_macro_quoted_spans.get(i)))
.take_while(|(_, o)| o.is_some())
.filter_map(|(i, o)| Some((i, o?)))
self.proc_macro_quoted_spans.iter_enumerated()
}
#[track_caller]