Skip to content

Commit

Permalink
Follow nical suggestion
Browse files Browse the repository at this point in the history
  • Loading branch information
gents83 committed Nov 27, 2023
1 parent 7568191 commit 00af74a
Showing 1 changed file with 2 additions and 4 deletions.
6 changes: 2 additions & 4 deletions wgpu-core/src/storage.rs
Original file line number Diff line number Diff line change
Expand Up @@ -208,16 +208,14 @@ where
let slot = &mut self.map[index as usize];
// borrowck dance: we have to move the element out before we can replace it
// with another variant with the same value.
if let &mut Element::Occupied(..) = slot {
if let &mut Element::Occupied(_, e) = slot {
if let Element::Occupied(value, storage_epoch) =
std::mem::replace(slot, Element::Vacant)
std::mem::replace(slot, Element::Destroyed(e))
{
debug_assert_eq!(storage_epoch, epoch);
*slot = Element::Destroyed(storage_epoch);
return Ok(value);
}
}

Err(InvalidId)
}

Expand Down

0 comments on commit 00af74a

Please sign in to comment.