]> git.lizzy.rs Git - rust.git/commit
Simplify hash table drops
authorJosh Stone <jistone@redhat.com>
Wed, 22 Mar 2017 17:32:38 +0000 (10:32 -0700)
committerJosh Stone <jistone@redhat.com>
Wed, 22 Mar 2017 17:32:38 +0000 (10:32 -0700)
commita033f1a8eeb55bdf93749a5d0c4d803bbe0d8dfc
treebdc15fafafdfbec66a4dab31347198a1164e8228
parentcab4bff3de1a61472f3c2e7752ef54b87344d1c9
Simplify hash table drops

This replaces the `std::collections::hash::table::RevMoveBuckets`
iterator with a simpler `while` loop.  This iterator was only used for
dropping the remaining elements of a `RawTable`, so instead we can just
loop through directly and drop them in place.

This should be functionally equivalent to the former code, but a little
easier to read.  I was hoping it might have some performance benefit
too, but it seems the optimizer was already good enough to see through
the iterator -- the generated code is nearly the same.  Maybe it will
still help if an element type has more complicated drop code.
src/libstd/collections/hash/table.rs