Skip to content

Commit

Permalink
Clippy
Browse files Browse the repository at this point in the history
  • Loading branch information
vnt-dev committed Dec 4, 2024
1 parent e32eebf commit d379986
Showing 1 changed file with 9 additions and 6 deletions.
15 changes: 9 additions & 6 deletions src/session.rs
Original file line number Diff line number Diff line change
Expand Up @@ -131,21 +131,21 @@ impl Session {
WaitForMultipleObjects(handles.len() as u32, &handles as _, FALSE, INFINITE)
};
const WAIT_OBJECT_1: WAIT_EVENT = WAIT_OBJECT_0 + 1;
match result {
WAIT_FAILED => return Err(util::get_last_error()?.into()),
return match result {
WAIT_FAILED => Err(util::get_last_error()?.into()),
WAIT_OBJECT_0 => {
//We have data!
return Ok(());
Ok(())
}
WAIT_OBJECT_1 => {
//Shutdown event triggered
return Err(Error::ShuttingDown);
Err(Error::ShuttingDown)
}
_ => {
//This should never happen
panic!("WaitForMultipleObjects returned unexpected value {:?}", result);
}
}
};
}

/// Cancels any active calls to [`Session::receive_blocking`] making them instantly return Err(_) so that session can be shutdown cleanly
Expand All @@ -171,7 +171,10 @@ impl Session {
}
let size = size as usize;
if size > buf.len() {
return Err(std::io::Error::new(std::io::ErrorKind::InvalidInput, "destination buffer too small").into());
return Err(std::io::Error::new(
std::io::ErrorKind::InvalidInput,
"destination buffer too small",
));
}
unsafe {
ptr::copy_nonoverlapping(ptr, buf.as_mut_ptr(), size);
Expand Down

0 comments on commit d379986

Please sign in to comment.