Skip to content

Commit

Permalink
fix: FilterIterator don't copy predicate closure
Browse files Browse the repository at this point in the history
  • Loading branch information
julio4 committed Jan 28, 2025
1 parent 695f5d2 commit c8fee23
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions corelib/src/iter/adapters/filter.cairo
Original file line number Diff line number Diff line change
Expand Up @@ -15,18 +15,17 @@ pub fn filter_iterator<I, P>(iter: I, predicate: P) -> Filter<I, P> {
Filter { iter, predicate }
}

pub impl FilterIterator<
impl FilterIterator<
I,
P,
impl TIter: Iterator<I>,
+core::ops::Fn<P, (@TIter::Item,)>[Output: bool],
+Destruct<I>,
+Destruct<P>,
+Copy<P>,
+Destruct<TIter::Item>,
> of Iterator<Filter<I, P>> {
type Item = TIter::Item;
fn next(ref self: Filter<I, P>) -> Option<Self::Item> {
self.iter.find(self.predicate)
self.iter.find(@self.predicate)
}
}

0 comments on commit c8fee23

Please sign in to comment.