From e51cfa0a824dbe02c3a4efc958fb3db7f7dc2199 Mon Sep 17 00:00:00 2001 From: Markus Stange Date: Sun, 19 Jan 2025 11:43:03 -0500 Subject: [PATCH] Fix Windows-only clippy warnings. This works around https://github.com/al8n/fs4-rs/issues/31 . --- samply/src/windows/utility_process/file_channel.rs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/samply/src/windows/utility_process/file_channel.rs b/samply/src/windows/utility_process/file_channel.rs index bd9e5825..78be6a71 100644 --- a/samply/src/windows/utility_process/file_channel.rs +++ b/samply/src/windows/utility_process/file_channel.rs @@ -113,7 +113,7 @@ impl Receiver { match self.current_lock.try_lock_exclusive() { Ok(()) => { // Not locked yet. - self.current_lock.unlock().unwrap(); + FileExt::unlock(&self.current_lock).unwrap(); } Err(e) if e.kind() == std::io::ErrorKind::Interrupted => {} Err(e) if e.raw_os_error() == lock_contended_error().raw_os_error() => { @@ -131,7 +131,7 @@ impl Receiver { pub fn recv_blocking(&mut self) -> Result> { self.current_lock.lock_exclusive()?; // block until init message is written let msg = self.reader.recv()?; - self.current_lock.unlock()?; + FileExt::unlock(&self.current_lock)?; std::mem::swap(&mut self.current_lock, &mut self.next_lock); Ok(msg) } @@ -166,7 +166,7 @@ impl Sender { self.writer.send(msg)?; self.next_lock.lock_exclusive()?; // ready next lock std::mem::swap(&mut self.current_lock, &mut self.next_lock); - self.next_lock.unlock()?; // indicate that reply has been written + FileExt::unlock(&self.next_lock)?; // indicate that reply has been written Ok(()) } }