Skip to content

Commit

Permalink
Make FoldHelper friendlier to debug mode
Browse files Browse the repository at this point in the history
  • Loading branch information
dtolnay committed May 19, 2024
1 parent 1a20798 commit b2ee932
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions src/gen_helper.rs
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,10 @@ pub(crate) mod fold {
F: FnMut(Self::Item) -> Self::Item,
{
self.into_pairs()
.map(Pair::into_tuple)
.map(|(t, p)| Pair::new(f(t), p))
.map(|pair| match pair {
Pair::Punctuated(t, p) => Pair::Punctuated(f(t), p),
Pair::End(t) => Pair::End(f(t)),
})
.collect()
}
}
Expand Down

0 comments on commit b2ee932

Please sign in to comment.