diff --git a/src/ripper/lib.rs b/src/ripper/lib.rs index c14f05a..a123f42 100644 --- a/src/ripper/lib.rs +++ b/src/ripper/lib.rs @@ -76,18 +76,14 @@ fn parse_ip(host: &str) -> Result { } fn do_request(dest: SocketAddr, socket: &UdpSocket) -> Result { - if socket.connect(dest).is_err() { - return Err(format!( - "Unable to connect: {}", - socket.take_error().unwrap().unwrap() - )); + match socket.connect(dest) { + Ok(_) => (), + Err(err) => return Err(format!("Unable to connect: {}", err)), } - if socket.send(&[]).is_err() { - return Err(format!( - "Failed to send request: {}", - socket.take_error().unwrap().unwrap() - )); + match socket.send(&[]) { + Ok(_) => (), + Err(err) => return Err(format!("Failed to send request: {}", err)), } let mut buf = [0; 1024];