let deads: Vec<((usize, _), _)> = beings
.thirsts
.iter()
.enumerate()
.zip(beings.hungers.iter())
.filter(|((_, hunger), thirst)| **hunger < 1 || **thirst < 1)
// .map(|((id, _), _)| id)
.collect();
This tuple ends up keeping references to beings.hungers and beings.thirsts that I don't need and which are causing borrow issues.
I can map them out with the commented out line, or I could clone them before iterating on them; both seem to work, but both seem to be wasteful. Can someone tell me a more correct approach? Thanks!