From 76e0eb374afc80ae70af6cd9ceb8c02d2231ec20 Mon Sep 17 00:00:00 2001 From: Caio Date: Wed, 3 Sep 2025 08:36:53 -0300 Subject: [PATCH 1/2] Add `#[has_significant_drop]` to guards --- futures-util/src/lock/mutex.rs | 3 +++ 1 file changed, 3 insertions(+) diff --git a/futures-util/src/lock/mutex.rs b/futures-util/src/lock/mutex.rs index 1a6363ea7..1027c600a 100644 --- a/futures-util/src/lock/mutex.rs +++ b/futures-util/src/lock/mutex.rs @@ -279,6 +279,7 @@ impl Drop for OwnedMutexLockFuture { /// An RAII guard returned by the `lock_owned` and `try_lock_owned` methods. /// When this structure is dropped (falls out of scope), the lock will be /// unlocked. +#[has_significant_drop] pub struct OwnedMutexGuard { mutex: Arc>, } @@ -388,6 +389,7 @@ impl Drop for MutexLockFuture<'_, T> { /// An RAII guard returned by the `lock` and `try_lock` methods. /// When this structure is dropped (falls out of scope), the lock will be /// unlocked. +#[has_significant_drop] pub struct MutexGuard<'a, T: ?Sized> { mutex: &'a Mutex, } @@ -449,6 +451,7 @@ impl DerefMut for MutexGuard<'_, T> { /// An RAII guard returned by the `MutexGuard::map` and `MappedMutexGuard::map` methods. /// When this structure is dropped (falls out of scope), the lock will be unlocked. +#[has_significant_drop] pub struct MappedMutexGuard<'a, T: ?Sized, U: ?Sized> { mutex: &'a Mutex, value: *mut U, From 2154568846c0b5af5ebeedd3b74cada6ea4fa83b Mon Sep 17 00:00:00 2001 From: Caio Date: Wed, 3 Sep 2025 08:42:35 -0300 Subject: [PATCH 2/2] Typo --- futures-util/src/lock/mutex.rs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/futures-util/src/lock/mutex.rs b/futures-util/src/lock/mutex.rs index 1027c600a..ccd2b7919 100644 --- a/futures-util/src/lock/mutex.rs +++ b/futures-util/src/lock/mutex.rs @@ -279,7 +279,7 @@ impl Drop for OwnedMutexLockFuture { /// An RAII guard returned by the `lock_owned` and `try_lock_owned` methods. /// When this structure is dropped (falls out of scope), the lock will be /// unlocked. -#[has_significant_drop] +#[clippy::has_significant_drop] pub struct OwnedMutexGuard { mutex: Arc>, } @@ -389,7 +389,7 @@ impl Drop for MutexLockFuture<'_, T> { /// An RAII guard returned by the `lock` and `try_lock` methods. /// When this structure is dropped (falls out of scope), the lock will be /// unlocked. -#[has_significant_drop] +#[clippy::has_significant_drop] pub struct MutexGuard<'a, T: ?Sized> { mutex: &'a Mutex, } @@ -451,7 +451,7 @@ impl DerefMut for MutexGuard<'_, T> { /// An RAII guard returned by the `MutexGuard::map` and `MappedMutexGuard::map` methods. /// When this structure is dropped (falls out of scope), the lock will be unlocked. -#[has_significant_drop] +#[clippy::has_significant_drop] pub struct MappedMutexGuard<'a, T: ?Sized, U: ?Sized> { mutex: &'a Mutex, value: *mut U,