Skip to content

Commit

Permalink
Condense the error matching block
Browse files Browse the repository at this point in the history
  • Loading branch information
asomers committed Jul 11, 2021
1 parent e742c5c commit fb7e888
Showing 1 changed file with 4 additions and 7 deletions.
11 changes: 4 additions & 7 deletions tokio/tests/uds_datagram.rs
Expand Up @@ -87,14 +87,11 @@ async fn try_send_recv_never_block() -> io::Result<()> {
dgram1.writable().await.unwrap();

match dgram1.try_send(payload) {
Err(err) => match err.kind() {
io::ErrorKind::WouldBlock => break,
Err(err) => match (err.kind(), err.raw_os_error()) {
(io::ErrorKind::WouldBlock, _) => break,
(_, Some(libc::ENOBUFS)) => break,
_ => {
let errno = err.raw_os_error().expect("Not an errno?");
if errno == libc::ENOBUFS {
break;
}
unreachable!("unexpected error {:?}", err);
panic!("unexpected error {:?}", err);
}
},
Ok(len) => {
Expand Down

0 comments on commit fb7e888

Please sign in to comment.