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:
bors[bot] 2022-05-04 15:56:30 +00:00 committed by GitHub
commit f7af9a549f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -165,10 +165,10 @@ impl<F: Future + 'static> TaskStorage<F> {
/// on a different executor.
pub fn spawn(&'static self, future: impl FnOnce() -> F) -> SpawnToken<impl Sized> {
if self.spawn_mark_used() {
unsafe { SpawnToken::<F>::new(self.spawn_initialize(future)) }
} else {
SpawnToken::<F>::new_failed()
return unsafe { SpawnToken::<F>::new(self.spawn_initialize(future)) };
}
SpawnToken::<F>::new_failed()
}
fn spawn_mark_used(&'static self) -> bool {