From c223fa379181210dd6fc399c0dc802259a8d9065 Mon Sep 17 00:00:00 2001
From: Daniel Bevenius <daniel.bevenius@gmail.com>
Date: Tue, 3 May 2022 16:08:48 +0200
Subject: [PATCH] Rename spawn_allocate to spawn_mark_used

This commit contains a suggestion to rename TaskStorage::spawn_allocate.

The motivation for this is when reading through the code I was
expecting something else to happen in this method, due to 'allocate' in
the method name.
---
 embassy/src/executor/raw/mod.rs | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/embassy/src/executor/raw/mod.rs b/embassy/src/executor/raw/mod.rs
index 5cf399cdf..fb6a55611 100644
--- a/embassy/src/executor/raw/mod.rs
+++ b/embassy/src/executor/raw/mod.rs
@@ -164,14 +164,14 @@ impl<F: Future + 'static> TaskStorage<F> {
     /// Once the task has finished running, you may spawn it again. It is allowed to spawn it
     /// on a different executor.
     pub fn spawn(&'static self, future: impl FnOnce() -> F) -> SpawnToken<impl Sized> {
-        if self.spawn_allocate() {
+        if self.spawn_mark_used() {
             unsafe { SpawnToken::<F>::new(self.spawn_initialize(future)) }
         } else {
             SpawnToken::<F>::new_failed()
         }
     }
 
-    fn spawn_allocate(&'static self) -> bool {
+    fn spawn_mark_used(&'static self) -> bool {
         let state = STATE_SPAWNED | STATE_RUN_QUEUED;
         self.raw
             .state
@@ -234,7 +234,7 @@ impl<F: Future + 'static, const N: usize> TaskPool<F, N> {
     /// which will cause [`Spawner::spawn()`] to return the error.
     pub fn spawn(&'static self, future: impl FnOnce() -> F) -> SpawnToken<impl Sized> {
         for task in &self.pool {
-            if task.spawn_allocate() {
+            if task.spawn_mark_used() {
                 return unsafe { SpawnToken::<F>::new(task.spawn_initialize(future)) };
             }
         }
@@ -282,7 +282,7 @@ impl<F: Future + 'static, const N: usize> TaskPool<F, N> {
         // by the user, with arbitrary hand-implemented futures. This is why these return `SpawnToken<F>`.
 
         for task in &self.pool {
-            if task.spawn_allocate() {
+            if task.spawn_mark_used() {
                 return SpawnToken::<FutFn>::new(task.spawn_initialize(future));
             }
         }