Merge #751
751: Use explicit return statement TaskStorage::spawn r=Dirbaio a=danbev
This commit removes the else branch in `TaskStorage::spawn`, and returns
explicitly from the if statement's branch, similar to what
[TaskPool::spawn](85c0525e01/embassy/src/executor/raw/mod.rs (L235-L243)
) does.
Co-authored-by: Daniel Bevenius <daniel.bevenius@gmail.com>
This commit is contained in:
commit
f7af9a549f
@ -165,10 +165,10 @@ impl<F: Future + 'static> TaskStorage<F> {
|
|||||||
/// on a different executor.
|
/// on a different executor.
|
||||||
pub fn spawn(&'static self, future: impl FnOnce() -> F) -> SpawnToken<impl Sized> {
|
pub fn spawn(&'static self, future: impl FnOnce() -> F) -> SpawnToken<impl Sized> {
|
||||||
if self.spawn_mark_used() {
|
if self.spawn_mark_used() {
|
||||||
unsafe { SpawnToken::<F>::new(self.spawn_initialize(future)) }
|
return unsafe { SpawnToken::<F>::new(self.spawn_initialize(future)) };
|
||||||
} else {
|
|
||||||
SpawnToken::<F>::new_failed()
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
SpawnToken::<F>::new_failed()
|
||||||
}
|
}
|
||||||
|
|
||||||
fn spawn_mark_used(&'static self) -> bool {
|
fn spawn_mark_used(&'static self) -> bool {
|
||||||
|
Loading…
Reference in New Issue
Block a user