mirror of
https://github.com/storytold/wgpu.git
synced 2026-11-25 08:51:05 +01:00
Merge #779
779: Fix hub insertion r=kvark a=kvark **Connections** Fixes #778 Follow-up to #776 **Description** Problem was `resize_with` takes new length, not a difference. **Testing** Untested Co-authored-by: Dzmitry Malyshau <kvarkus@gmail.com>
This commit is contained in:
commit
bd9167ebbc
1 file changed
+2
-2
@@ -138,8 +138,8 @@ impl<T, I: TypedId> Storage<T, I> {
|
||||
|
||||
pub fn insert(&mut self, id: I, value: T) {
|
||||
let (index, epoch, _) = id.unzip();
|
||||
if let Some(diff) = (index as usize).checked_sub(self.map.len()) {
|
||||
self.map.resize_with(diff + 1, || Element::Vacant);
|
||||
if index as usize >= self.map.len() {
|
||||
self.map.resize_with(index as usize + 1, || Element::Vacant);
|
||||
}
|
||||
match std::mem::replace(
|
||||
&mut self.map[index as usize],
|
||||
|
||||
Reference in new issue
Block a user