Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 2 additions & 9 deletions src/experimental/coroutines/generational_storage.rs
Original file line number Diff line number Diff line change
Expand Up @@ -51,10 +51,7 @@ impl<T> GenerationalStorage<T> {
return None;
}

if self.vec[id.id].is_none() {
return None;
}
let cell = self.vec[id.id].as_ref().unwrap();
let cell = self.vec[id.id].as_ref()?;
if cell.generation != id.generation {
return None;
}
Expand All @@ -67,10 +64,7 @@ impl<T> GenerationalStorage<T> {
return None;
}

if self.vec[id.id].is_none() {
return None;
}
let cell = self.vec[id.id].as_mut().unwrap();
let cell = self.vec[id.id].as_mut()?;
if cell.generation != id.generation {
return None;
}
Expand All @@ -79,7 +73,6 @@ impl<T> GenerationalStorage<T> {
}

/// Retains only the elements specified by the predicate, passing a mutable reference to it.

/// In other words, remove all elements e such that f(&mut e) returns false. This method operates in place, visiting each element exactly once in the original order, and preserves the order of the retained elements.
pub fn retain<F>(&mut self, mut f: F)
where
Expand Down
5 changes: 1 addition & 4 deletions src/experimental/scene.rs
Original file line number Diff line number Diff line change
Expand Up @@ -426,10 +426,7 @@ impl Scene {
}

pub fn get<T>(&mut self, handle: Handle<T>) -> Option<RefMut<T>> {
if handle.id.is_none() {
return None;
}
let ref_mut_any = self.get_any(HandleUntyped(handle.id.unwrap()))?;
let ref_mut_any = self.get_any(HandleUntyped(handle.id?))?;
Some(ref_mut_any.to_typed())
}

Expand Down
Loading