Replace manual iterator exhaust with for_each(drop)
This originally added a dedicated method, `Iterator::exhaust`, and has since been replaced with `for_each(drop)`, which is more idiomatic.
<del>This is just shorthand for `for _ in &mut self {}` or `while let Some(_) = self.next() {}`. This states the intent a lot more clearly than the identical code: run the iterator to completion.
<del>At least personally, my eyes tend to gloss over `for _ in &mut self {}` without fully paying attention to what it does; having a `Drop` implementation akin to:
<del>`for _ in &mut self {}; unsafe { free(self.ptr); }`</del>
<del>Is not as clear as:
<del>`self.exhaust(); unsafe { free(self.ptr); }`
<del>Additionally, I've seen debate over whether `while let Some(_) = self.next() {}` or `for _ in &mut self {}` is more clear, whereas `self.exhaust()` is clearer than both.
|
||
|---|---|---|
| .. | ||
| control_flow_graph | ||
| graph | ||
| obligation_forest | ||
| owning_ref | ||
| snapshot_map | ||
| accumulate_vec.rs | ||
| array_vec.rs | ||
| base_n.rs | ||
| bitslice.rs | ||
| bitvec.rs | ||
| Cargo.toml | ||
| flock.rs | ||
| fx.rs | ||
| indexed_set.rs | ||
| indexed_vec.rs | ||
| lib.rs | ||
| sip128.rs | ||
| small_vec.rs | ||
| stable_hasher.rs | ||
| sync.rs | ||
| transitive_relation.rs | ||
| tuple_slice.rs | ||