aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDaniel Bevenius <[email protected]>2022-05-04 16:11:23 +0200
committerDaniel Bevenius <[email protected]>2022-05-04 16:11:55 +0200
commit34493c7ed6c4fdf3e5fb823b9121906d6c3fef0e (patch)
tree0a377a54472ddbdd090db1fd472b806d15213493
parent85c0525e01c52bbb85c7b93600a60837ee7b87dc (diff)
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.
-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..24150511a 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 {