6 ms·
you could use move_iter() instead of iter(), its more idiomatic.
by thikonom 12y ago
you could use move_iter() instead of iter(), its more idiomatic.
- burntsushi 12y agoHuh? They serve two different purposes. `move_iter` returns an iterator that consumes values (i.e., ownership transfers) while `iter` consumes borrowed references to values (i.e., no ownership transfer). The only place in the code, that I can spot, where `move_iter` is even available is on line 46. But I don't see any compelling reason to use move_iter there (plus, `validation_sample.len()` in the final println would have to be moved up and let bound before the call to move_iter).
- steveklabnik 12y agoI think they were trying to say that borrowing is preferred over ownership transfer.
- dbaupp 12y agoI don't need ownership inside the loop, so using `.iter` is fine. `.iter` is also allows the inner loop to be free from destructors, meaning it will be tighter and (likely) faster.