From b4a47f4cbd83b6a72bd14247e91a5d70d0385dc8 Mon Sep 17 00:00:00 2001 From: keithmattix Date: Thu, 12 Sep 2024 11:58:26 -0500 Subject: [PATCH] cargo fmt and more specific imports Signed-off-by: keithmattix --- src/sys/windows.rs | 26 ++++++++++++++------------ tests/socket.rs | 1 + 2 files changed, 15 insertions(+), 12 deletions(-) diff --git a/src/sys/windows.rs b/src/sys/windows.rs index 9b6da798..729be055 100644 --- a/src/sys/windows.rs +++ b/src/sys/windows.rs @@ -20,13 +20,15 @@ use std::time::{Duration, Instant}; use std::{process, ptr, slice}; use windows_sys::Win32::Foundation::{SetHandleInformation, HANDLE, HANDLE_FLAG_INHERIT}; -#[cfg(feature = "all")] -use windows_sys::Win32::Networking::WinSock::{SO_PROTOCOL_INFOW, SO_ORIGINAL_DST, IP6T_SO_ORIGINAL_DST, SOL_IP}; use windows_sys::Win32::Networking::WinSock::{ self, tcp_keepalive, FIONBIO, IN6_ADDR, IN6_ADDR_0, INVALID_SOCKET, IN_ADDR, IN_ADDR_0, POLLERR, POLLHUP, POLLRDNORM, POLLWRNORM, SD_BOTH, SD_RECEIVE, SD_SEND, SIO_KEEPALIVE_VALS, SOCKET_ERROR, WSABUF, WSAEMSGSIZE, WSAESHUTDOWN, WSAPOLLFD, WSAPROTOCOL_INFOW, - WSA_FLAG_NO_HANDLE_INHERIT, WSA_FLAG_OVERLAPPED + WSA_FLAG_NO_HANDLE_INHERIT, WSA_FLAG_OVERLAPPED, +}; +#[cfg(feature = "all")] +use windows_sys::Win32::Networking::WinSock::{ + IP6T_SO_ORIGINAL_DST, SOL_IP, SO_ORIGINAL_DST, SO_PROTOCOL_INFOW, }; use windows_sys::Win32::System::Threading::INFINITE; @@ -77,7 +79,7 @@ pub(crate) use windows_sys::Win32::Networking::WinSock::{ IP_MREQ_SOURCE as IpMreqSource, IP_MULTICAST_IF, IP_MULTICAST_LOOP, IP_MULTICAST_TTL, IP_RECVTOS, IP_TOS, IP_TTL, LINGER as linger, MSG_OOB, MSG_PEEK, SO_BROADCAST, SO_ERROR, SO_KEEPALIVE, SO_LINGER, SO_OOBINLINE, SO_RCVBUF, SO_RCVTIMEO, SO_REUSEADDR, SO_SNDBUF, - SO_SNDTIMEO, SO_TYPE, TCP_NODELAY + SO_SNDTIMEO, SO_TYPE, TCP_NODELAY, }; pub(crate) const IPPROTO_IP: c_int = windows_sys::Win32::Networking::WinSock::IPPROTO_IP as c_int; pub(crate) const SOL_SOCKET: c_int = windows_sys::Win32::Networking::WinSock::SOL_SOCKET as c_int; @@ -941,10 +943,10 @@ impl crate::Socket { SO_ORIGINAL_DST as i32, storage.cast(), len, - ), - PartialEq::eq, - SOCKET_ERROR - ) + ), + PartialEq::eq, + SOCKET_ERROR + ) }) } .map(|(_, addr)| addr) @@ -964,10 +966,10 @@ impl crate::Socket { IP6T_SO_ORIGINAL_DST as i32, storage.cast(), len, - ), - PartialEq::eq, - SOCKET_ERROR - ) + ), + PartialEq::eq, + SOCKET_ERROR + ) }) } .map(|(_, addr)| addr) diff --git a/tests/socket.rs b/tests/socket.rs index d8f17f0e..fc7d5497 100644 --- a/tests/socket.rs +++ b/tests/socket.rs @@ -42,6 +42,7 @@ use std::num::NonZeroUsize; use std::os::unix::io::AsRawFd; #[cfg(windows)] use std::os::windows::io::AsRawSocket; +#[cfg(windows)] use windows_sys::Win32::Networking::WinSock::WSAEINVAL; #[cfg(unix)]