Skip to content

Commit 4d9804f

Browse files
arihant2mathcoolreader18
authored andcommitted
formatting
1 parent 3ae1160 commit 4d9804f

1 file changed

Lines changed: 22 additions & 22 deletions

File tree

‎stdlib/src/socket.rs‎

Lines changed: 22 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -36,27 +36,12 @@ mod _socket {
3636
#[cfg(windows)]
3737
mod c {
3838
pub use windows_sys::Win32::NetworkManagement::IpHelper::{if_indextoname, if_nametoindex};
39-
39+
4040
pub const INADDR_ANY: u32 = 0x00000000;
4141
pub const INADDR_LOOPBACK: u32 = 0x7f000001;
4242
pub const INADDR_BROADCAST: u32 = 0xffffffff;
4343
pub const INADDR_NONE: u32 = 0xffffffff;
44-
45-
pub use windows_sys::Win32::Networking::WinSock::{
46-
SO_REUSEADDR as SO_EXCLUSIVEADDRUSE, getprotobyname, getservbyname, getservbyport, getsockopt,
47-
setsockopt,
48-
};
49-
pub use windows_sys::Win32::Networking::WinSock::{
50-
WSATRY_AGAIN as EAI_AGAIN,
51-
WSAEINVAL as EAI_BADFLAGS,
52-
WSANO_RECOVERY as EAI_FAIL,
53-
WSAEAFNOSUPPORT as EAI_FAMILY,
54-
WSA_NOT_ENOUGH_MEMORY as EAI_MEMORY,
55-
WSAHOST_NOT_FOUND as EAI_NODATA,
56-
WSAHOST_NOT_FOUND as EAI_NONAME,
57-
WSATYPE_NOT_FOUND as EAI_SERVICE,
58-
WSAESOCKTNOSUPPORT as EAI_SOCKTYPE,
59-
};
44+
6045
pub use windows_sys::Win32::Networking::WinSock::{
6146
AF_APPLETALK, AF_DECnet, AF_IPX, AF_LINK, AI_ADDRCONFIG, AI_ALL, AI_CANONNAME,
6247
AI_NUMERICSERV, AI_V4MAPPED, IP_ADD_MEMBERSHIP, IP_DROP_MEMBERSHIP, IP_HDRINCL,
@@ -78,6 +63,17 @@ mod _socket {
7863
SOL_SOCKET, SOMAXCONN, TCP_NODELAY, WSAEBADF, WSAECONNRESET, WSAENOTSOCK,
7964
WSAEWOULDBLOCK,
8065
};
66+
pub use windows_sys::Win32::Networking::WinSock::{
67+
SO_REUSEADDR as SO_EXCLUSIVEADDRUSE, getprotobyname, getservbyname, getservbyport,
68+
getsockopt, setsockopt,
69+
};
70+
pub use windows_sys::Win32::Networking::WinSock::{
71+
WSA_NOT_ENOUGH_MEMORY as EAI_MEMORY, WSAEAFNOSUPPORT as EAI_FAMILY,
72+
WSAEINVAL as EAI_BADFLAGS, WSAESOCKTNOSUPPORT as EAI_SOCKTYPE,
73+
WSAHOST_NOT_FOUND as EAI_NODATA, WSAHOST_NOT_FOUND as EAI_NONAME,
74+
WSANO_RECOVERY as EAI_FAIL, WSATRY_AGAIN as EAI_AGAIN,
75+
WSATYPE_NOT_FOUND as EAI_SERVICE,
76+
};
8177
pub const IF_NAMESIZE: usize =
8278
windows_sys::Win32::NetworkManagement::Ndis::IF_MAX_STRING_SIZE as _;
8379
pub const AF_UNSPEC: i32 = windows_sys::Win32::Networking::WinSock::AF_UNSPEC as _;
@@ -1766,7 +1762,12 @@ mod _socket {
17661762
.transpose()?;
17671763
let cstr_proto = cstr_opt_as_ptr(&cstr_proto);
17681764
#[cfg(windows)]
1769-
let serv = unsafe { c::getservbyname(cstr_name.as_ptr() as windows_sys::core::PCSTR, cstr_proto as windows_sys::core::PCSTR) };
1765+
let serv = unsafe {
1766+
c::getservbyname(
1767+
cstr_name.as_ptr() as windows_sys::core::PCSTR,
1768+
cstr_proto as windows_sys::core::PCSTR,
1769+
)
1770+
};
17701771
#[cfg(not(windows))]
17711772
let serv = unsafe { c::getservbyname(cstr_name.as_ptr(), cstr_proto) };
17721773
if serv.is_null() {
@@ -1791,7 +1792,8 @@ mod _socket {
17911792
.transpose()?;
17921793
let cstr_proto = cstr_opt_as_ptr(&cstr_proto);
17931794
#[cfg(windows)]
1794-
let serv = unsafe { c::getservbyport(port.to_be() as _, cstr_proto as windows_sys::core::PCSTR) };
1795+
let serv =
1796+
unsafe { c::getservbyport(port.to_be() as _, cstr_proto as windows_sys::core::PCSTR) };
17951797
#[cfg(not(windows))]
17961798
let serv = unsafe { c::getservbyport(port.to_be() as _, cstr_proto) };
17971799
if serv.is_null() {
@@ -2211,9 +2213,7 @@ mod _socket {
22112213
let list = list.collect::<PyResult<_>>()?;
22122214
return Ok(list);
22132215

2214-
fn get_name(
2215-
luid: &NET_LUID_LH,
2216-
) -> io::Result<widestring::WideCString> {
2216+
fn get_name(luid: &NET_LUID_LH) -> io::Result<widestring::WideCString> {
22172217
let mut buf = [0; c::IF_NAMESIZE + 1];
22182218
let ret = unsafe {
22192219
IpHelper::ConvertInterfaceLuidToNameW(luid, buf.as_mut_ptr(), buf.len())

0 commit comments

Comments
 (0)