fn remove_waiter(
        &mut self,
        wait_node: &mut ListNode<WaitQueueEntry>,
    ) -> Option<Waker> {
        // MutexLockFuture only needs to get removed if it had been added to
        // the wait queue of the Mutex. This has happened in the PollState::Waiting case.
        // If the current waiter was notified, another waiter must get notified now.
        match wait_node.state {
            PollState::Notified => {
                if self.is_fair {
                    // In a fair Mutex, the WaitQueueEntry is kept in the
                    // linked list and must be removed here
                    // Safety: Due to the state, we know that the node must be part
                    // of the waiter list
                    unsafe { self.force_remove_waiter(wait_node) };
                }
                wait_node.state = PollState::Done;
                // Since the task was notified but did not lock the Mutex,
                // another task gets the chance to run.
                self.return_last_waiter()
            }
            PollState::Waiting => {
                // Remove the WaitQueueEntry from the linked list
                // Safety: Due to the state, we know that the node must be part
                // of the waiter list
                unsafe { self.force_remove_waiter(wait_node) };
                wait_node.state = PollState::Done;
                None
            }
            PollState::New | PollState::Done => None,
        }
    }
/// Removes the waiter from the list.
///
/// This function is only safe as long as the reference that is passed here
/// equals the reference/address under which the waiter was added.
/// The waiter must not have been moved in between.
///
/// Returns the `Waker` of another task which might get ready to run due to
/// this.
Removes the waiter from the list.
This function is only safe as long as the reference that is passed here
equals the reference/address under which the waiter was added.
The waiter must not have been moved in between.

Returns the `Waker` of another task which might get ready to run due to
this.
Removes the waiter from the list . This function is only safe as long as the reference that is passed here equals the reference / address under which the waiter was added . The waiter must not have been moved in between . Returns the ` Waker ` of another task which might get ready to run due to this .
fn remove_waiter(
        &mut self,
        wait_node: &mut ListNode<WaitQueueEntry>,
    ) -> Option<Waker> {
        // MutexLockFuture only needs to get removed if it had been added to
        // the wait queue of the Mutex. This has happened in the PollState::Waiting case.
        // If the current waiter was notified, another waiter must get notified now.
        match wait_node.state {
            PollState::Notified => {
                if self.is_fair {
                    // In a fair Mutex, the WaitQueueEntry is kept in the
                    // linked list and must be removed here
                    // Safety: Due to the state, we know that the node must be part
                    // of the waiter list
                    unsafe { self.force_remove_waiter(wait_node) };
                }
                wait_node.state = PollState::Done;
                // Since the task was notified but did not lock the Mutex,
                // another task gets the chance to run.
                self.return_last_waiter()
            }
            PollState::Waiting => {
                // Remove the WaitQueueEntry from the linked list
                // Safety: Due to the state, we know that the node must be part
                // of the waiter list
                unsafe { self.force_remove_waiter(wait_node) };
                wait_node.state = PollState::Done;
                None
            }
            PollState::New | PollState::Done => None,
        }
    }
fn remove_waiter ( & mut self , wait_node : & mut ListNode < WaitQueueEntry > , ) -> Option < Waker > { // MutexLockFuture only needs to get removed if it had been added to // the wait queue of the Mutex. This has happened in the PollState::Waiting case. // If the current waiter was notified, another waiter must get notified now. match wait_node . state { PollState :: Notified => { if self . is_fair { // In a fair Mutex, the WaitQueueEntry is kept in the // linked list and must be removed here // Safety: Due to the state, we know that the node must be part // of the waiter list unsafe { self . force_remove_waiter ( wait_node ) } ; } wait_node . state = PollState :: Done ; // Since the task was notified but did not lock the Mutex, // another task gets the chance to run. self . return_last_waiter ( ) } PollState :: Waiting => { // Remove the WaitQueueEntry from the linked list // Safety: Due to the state, we know that the node must be part // of the waiter list unsafe { self . force_remove_waiter ( wait_node ) } ; wait_node . state = PollState :: Done ; None } PollState :: New | PollState :: Done => None , } }
Removes the waiter from the list.
Removes the waiter from the list .
&mut self
wait_node
&mut ListNode<WaitQueueEntry>
&mut self
wait_node
&mut ListNode<WaitQueueEntry>