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:
		| @@ -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 { | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user