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
Looking at how pub fn cartesian_product<I, J>(mut i: I, j: J) -> Product<I, J> initialises Product, one can see that it yields the first item in i.
Wouldn't it be better if Product.a_cur was an Option<Option<I::Item>> and initialized as None, rather than initializing it by starting the consumption of i?
This may cause problems if iteration over i has side effects.
Same with Product.b too. No reason to clone it ahead of time.
I haven't looked deep into at the implementation of multi_cartesian_product but it may be a similar situation there too.