aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorbors[bot] <26634292+bors[bot]@users.noreply.github.com>2022-05-04 15:56:30 +0000
committerGitHub <[email protected]>2022-05-04 15:56:30 +0000
commitf7af9a549f165419f4fa85c82b42a3e5b54d417e (patch)
treed8e9b47fab71e7b2b8d09edb0f557191d0eb91a4
parent85c0525e01c52bbb85c7b93600a60837ee7b87dc (diff)
parent0ce29ca84c819a8a8587bf50101666fd9f4dbbf7 (diff)
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](https://github.com/embassy-rs/embassy/blob/85c0525e01c52bbb85c7b93600a60837ee7b87dc/embassy/src/executor/raw/mod.rs#L235-L243) does. Co-authored-by: Daniel Bevenius <[email protected]>
-rw-r--r--embassy/src/executor/raw/mod.rs6
1 files changed, 3 insertions, 3 deletions
diff --git a/embassy/src/executor/raw/mod.rs b/embassy/src/executor/raw/mod.rs
index fb6a55611..5034c0d66 100644
--- a/embassy/src/executor/raw/mod.rs
+++ b/embassy/src/executor/raw/mod.rs
@@ -165,10 +165,10 @@ impl<F: Future + 'static> TaskStorage<F> {
165 /// on a different executor. 165 /// on a different executor.
166 pub fn spawn(&'static self, future: impl FnOnce() -> F) -> SpawnToken<impl Sized> { 166 pub fn spawn(&'static self, future: impl FnOnce() -> F) -> SpawnToken<impl Sized> {
167 if self.spawn_mark_used() { 167 if self.spawn_mark_used() {
168 unsafe { SpawnToken::<F>::new(self.spawn_initialize(future)) } 168 return unsafe { SpawnToken::<F>::new(self.spawn_initialize(future)) };
169 } else {
170 SpawnToken::<F>::new_failed()
171 } 169 }
170
171 SpawnToken::<F>::new_failed()
172 } 172 }
173 173
174 fn spawn_mark_used(&'static self) -> bool { 174 fn spawn_mark_used(&'static self) -> bool {