diff --git a/samply-symbols/src/demangle_ocaml.rs b/samply-symbols/src/demangle_ocaml.rs index d7ce0bde..ae5d9c12 100644 --- a/samply-symbols/src/demangle_ocaml.rs +++ b/samply-symbols/src/demangle_ocaml.rs @@ -1,6 +1,6 @@ pub fn demangle(name: &str) -> Option { if let Some(name) = name.strip_prefix("caml") { - if name.chars().next().map_or(false, |c| !c.is_uppercase()) { + if name.chars().next().is_some_and(|c| !c.is_uppercase()) { return None; } 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(()) } }