Skip to content

Commit ea7ec56

Browse files
cyrganinot-fl3
authored andcommitted
apply clippy::question_mark lint
1 parent d94bc7a commit ea7ec56

File tree

2 files changed

+3
-13
lines changed

2 files changed

+3
-13
lines changed

src/experimental/coroutines/generational_storage.rs

Lines changed: 2 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -51,10 +51,7 @@ impl<T> GenerationalStorage<T> {
5151
return None;
5252
}
5353

54-
if self.vec[id.id].is_none() {
55-
return None;
56-
}
57-
let cell = self.vec[id.id].as_ref().unwrap();
54+
let cell = self.vec[id.id].as_ref()?;
5855
if cell.generation != id.generation {
5956
return None;
6057
}
@@ -67,10 +64,7 @@ impl<T> GenerationalStorage<T> {
6764
return None;
6865
}
6966

70-
if self.vec[id.id].is_none() {
71-
return None;
72-
}
73-
let cell = self.vec[id.id].as_mut().unwrap();
67+
let cell = self.vec[id.id].as_mut()?;
7468
if cell.generation != id.generation {
7569
return None;
7670
}
@@ -79,7 +73,6 @@ impl<T> GenerationalStorage<T> {
7973
}
8074

8175
/// Retains only the elements specified by the predicate, passing a mutable reference to it.
82-
8376
/// 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.
8477
pub fn retain<F>(&mut self, mut f: F)
8578
where

src/experimental/scene.rs

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -426,10 +426,7 @@ impl Scene {
426426
}
427427

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

0 commit comments

Comments
 (0)