Use explicit return statement TaskStorage::spawn
This commit removes the else branch in TaskStorage::spawn, and returns explicitly from the if statement's branch, similar to what TaskPool::spawn does.
This commit is contained in:
parent
85c0525e01
commit
34493c7ed6
1 changed files with 3 additions and 3 deletions
|
@ -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 a new issue