rust: pin-init: examples: fix incorrect drop

Remove the drop and associated clippy allow. The warning reported by Clippy
here is genuine; the binding created is `Pin<&mut T>` so dropping it does
nothing. `stack_pin_init` created bindings are only dropped at the end of
scope.

Reviewed-by: Benno Lossin <[email protected]>
Link: https://patch.msgid.link/[email protected]
Signed-off-by: Gary Guo <[email protected]>
This commit is contained in:
Gary Guo committed 2026-07-13 12:09:41 +01:00
1 parent f26f2f22c6
commit 554d1afffc
1 file changed
+1 -4
+1 -4
View File
@@ -91,7 +91,7 @@ impl<T> CMutex<T> {
pub fn lock(&self) -> Pin<CMutexGuard<'_, T>> {
let mut sguard = self.spin_lock.acquire();
if self.locked.get() {
stack_pin_init!(let wait_entry = WaitEntry::insert_new(&self.wait_list));
stack_pin_init!(let _wait_entry = WaitEntry::insert_new(&self.wait_list));
// println!("wait list length: {}", self.wait_list.size());
while self.locked.get() {
drop(sguard);
@@ -99,9 +99,6 @@ impl<T> CMutex<T> {
thread::park();
sguard = self.spin_lock.acquire();
}
// This does have an effect, as the ListHead inside wait_entry implements Drop!
#[expect(clippy::drop_non_drop)]
drop(wait_entry);
}
self.locked.set(true);
unsafe {