garage_model: fix warning about dead code

This commit is contained in:
Alex 2025-02-14 18:11:44 +01:00
parent 5b26545abf
commit 24470377c9
2 changed files with 9 additions and 2 deletions

View file

@ -329,7 +329,7 @@ impl Garage {
pub async fn locked_helper(&self) -> helper::locked::LockedHelper { pub async fn locked_helper(&self) -> helper::locked::LockedHelper {
let lock = self.bucket_lock.lock().await; let lock = self.bucket_lock.lock().await;
helper::locked::LockedHelper(self, lock) helper::locked::LockedHelper(self, Some(lock))
} }
} }

View file

@ -27,9 +27,16 @@ use crate::permission::BucketKeyPerm;
/// See issues: #649, #723 /// See issues: #649, #723
pub struct LockedHelper<'a>( pub struct LockedHelper<'a>(
pub(crate) &'a Garage, pub(crate) &'a Garage,
pub(crate) tokio::sync::MutexGuard<'a, ()>, pub(crate) Option<tokio::sync::MutexGuard<'a, ()>>,
); );
impl<'a> Drop for LockedHelper<'a> {
fn drop(&mut self) {
// make it explicit that the mutexguard lives until here
drop(self.1.take())
}
}
#[allow(clippy::ptr_arg)] #[allow(clippy::ptr_arg)]
impl<'a> LockedHelper<'a> { impl<'a> LockedHelper<'a> {
pub fn bucket(&self) -> BucketHelper<'a> { pub fn bucket(&self) -> BucketHelper<'a> {