Skip to content

Commit

Permalink
Merge pull request #469 from mstange/fix-clippy
Browse files Browse the repository at this point in the history
Fix clippy warnings.
  • Loading branch information
mstange authored Jan 19, 2025
2 parents 1cb135d + e51cfa0 commit ec0a6a1
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion samply-symbols/src/demangle_ocaml.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
pub fn demangle(name: &str) -> Option<String> {
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;
}

Expand Down
6 changes: 3 additions & 3 deletions samply/src/windows/utility_process/file_channel.rs
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@ impl<T: DeserializeOwned> Receiver<T> {
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() => {
Expand All @@ -131,7 +131,7 @@ impl<T: DeserializeOwned> Receiver<T> {
pub fn recv_blocking(&mut self) -> Result<T, Box<dyn Error + Send + Sync>> {
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)
}
Expand Down Expand Up @@ -166,7 +166,7 @@ impl<T: Serialize> Sender<T> {
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(())
}
}
Expand Down

0 comments on commit ec0a6a1

Please sign in to comment.