You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
709: fix: take_while_inclusive takes iterator by value r=phimuemue a=abhikjain360
this helps in case `TakeWhileInclusive` is returned from a function, as otherwise we would be returning a struct which takes a reference from a locally created iterator.
example code which breaks, but shouldn't:
```rust
use itertools::Itertools;
struct Entry {
constraint: bool,
}
struct List {
entries: Vec<Entry>,
}
impl List {
fn special(&self) -> impl Iterator<Item = &Entry> {
self
.entries
.iter()
.take_while_inclusive(|entry| entry.constraint)
}
}
```
Rust Playground: https://play.rust-lang.org/?version=stable&mode=debug&edition=2021&gist=f602ba3c6e7c2ab2f5132a0b40b80ceb
Co-authored-by: Abhik Jain <abhik@abhikjain.xyz>
0 commit comments