Skip to content

Commit

Permalink
Do not perform superfluous bounds checks on drop
Browse files Browse the repository at this point in the history
  • Loading branch information
Shnatsel committed Oct 27, 2019
1 parent d2ab7a5 commit ebb6b5f
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions crossbeam-epoch/src/internal.rs
Original file line number Diff line number Diff line change
Expand Up @@ -133,10 +133,10 @@ impl Default for Bag {
impl Drop for Bag {
fn drop(&mut self) {
// Call all deferred functions.
for i in 0..self.len {
for deferred in &mut self.deferreds[..self.len] {
let no_op = Deferred::new(no_op_func);
let deferred = mem::replace(&mut self.deferreds[i], no_op);
deferred.call();
let owned_deferred = mem::replace(deferred, no_op);
owned_deferred.call();
}
}
}
Expand Down

0 comments on commit ebb6b5f

Please sign in to comment.