From b50ababac8cf9c23e99c1c79a2debcd40da9fd0d Mon Sep 17 00:00:00 2001 From: Lorenzo Felletti Date: Wed, 10 Jul 2024 00:12:00 +0100 Subject: [PATCH] style: minor improvements --- Cargo.lock | 2 +- Cargo.toml | 2 +- src/socket/tcp.rs | 2 +- src/socket/tls.rs | 1 - src/socket/udp.rs | 8 ++++---- 5 files changed, 7 insertions(+), 8 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index fd2bc1a..094ab30 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -509,7 +509,7 @@ dependencies = [ [[package]] name = "psp-net" -version = "0.5.3" +version = "0.5.4" dependencies = [ "bitflags", "dns-protocol", diff --git a/Cargo.toml b/Cargo.toml index ece6558..a82767e 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "psp-net" -version = "0.5.3" +version = "0.5.4" edition = "2021" license-file = "LICENSE" keywords = ["psp", "net", "networking", "embedded", "gamedev"] diff --git a/src/socket/tcp.rs b/src/socket/tcp.rs index be13a95..4ef423a 100644 --- a/src/socket/tcp.rs +++ b/src/socket/tcp.rs @@ -181,7 +181,7 @@ impl TcpSocket { self.send_flags.as_i32(), ) }; - if (result as i32) < 0 { + if result < 0 { Err(SocketError::Errno(unsafe { sys::sceNetInetGetErrno() })) } else { self.buffer.shift_left_buffer(result as usize); diff --git a/src/socket/tls.rs b/src/socket/tls.rs index 10311a0..52aa198 100644 --- a/src/socket/tls.rs +++ b/src/socket/tls.rs @@ -24,7 +24,6 @@ pub struct TlsSocket<'a> { tls_connection: TlsConnection<'a, TcpSocket, Aes128GcmSha256>, /// The TLS config tls_config: TlsConfig<'a, Aes128GcmSha256>, - // certificate: Option>, } impl<'a> TlsSocket<'a> { diff --git a/src/socket/udp.rs b/src/socket/udp.rs index c69e8d0..393466e 100644 --- a/src/socket/udp.rs +++ b/src/socket/udp.rs @@ -185,7 +185,7 @@ impl UdpSocket { self.recv_flags.as_i32(), ) }; - if (result as i32) < 0 { + if result < 0 { Err(SocketError::Errno(unsafe { sys::sceNetInetGetErrno() })) } else { Ok(result as usize) @@ -220,7 +220,7 @@ impl UdpSocket { &mut Self::socket_len(), ) }; - if (result as i32) < 0 { + if result < 0 { Err(SocketError::Errno(unsafe { sys::sceNetInetGetErrno() })) } else { Ok(result as usize) @@ -268,7 +268,7 @@ impl UdpSocket { socklen, ) }; - if (result as i32) < 0 { + if result < 0 { Err(SocketError::Errno(unsafe { sys::sceNetInetGetErrno() })) } else { self.buffer.shift_left_buffer(result as usize); @@ -321,7 +321,7 @@ impl UdpSocket { self.send_flags.as_i32(), ) }; - if (result as i32) < 0 { + if result < 0 { Err(SocketError::Errno(unsafe { sys::sceNetInetGetErrno() })) } else { self.buffer.shift_left_buffer(result as usize);