Skip to content

Commit 3d8329f

Browse files
committed
ext/ucred: fmt check
1 parent fe0bea2 commit 3d8329f

File tree

2 files changed

+8
-26
lines changed

2 files changed

+8
-26
lines changed

library/std/src/sys/unix/ext/ucred.rs

+7-21
Original file line numberDiff line numberDiff line change
@@ -28,17 +28,10 @@ pub struct UCred {
2828
#[cfg(any(target_os = "android", target_os = "linux"))]
2929
pub use self::impl_linux::peer_cred;
3030

31-
#[cfg(any(
32-
target_os = "dragonfly",
33-
target_os = "freebsd",
34-
target_os = "openbsd"
35-
))]
31+
#[cfg(any(target_os = "dragonfly", target_os = "freebsd", target_os = "openbsd"))]
3632
pub use self::impl_bsd::peer_cred;
3733

38-
#[cfg(any(
39-
target_os = "macos",
40-
target_os = "ios",
41-
))]
34+
#[cfg(any(target_os = "macos", target_os = "ios",))]
4235
pub use self::impl_mac::peer_cred;
4336

4437
#[cfg(any(target_os = "linux", target_os = "android"))]
@@ -77,11 +70,7 @@ pub mod impl_linux {
7770
}
7871
}
7972

80-
#[cfg(any(
81-
target_os = "dragonfly",
82-
target_os = "freebsd",
83-
target_os = "openbsd"
84-
))]
73+
#[cfg(any(target_os = "dragonfly", target_os = "freebsd", target_os = "openbsd"))]
8574
pub mod impl_bsd {
8675
use super::UCred;
8776
use crate::io;
@@ -98,16 +87,13 @@ pub mod impl_bsd {
9887
}
9988
}
10089

101-
#[cfg(any(
102-
target_os = "macos",
103-
target_os = "ios",
104-
))]
90+
#[cfg(any(target_os = "macos", target_os = "ios",))]
10591
pub mod impl_mac {
10692
use super::UCred;
107-
use crate::{io, mem};
10893
use crate::os::unix::io::AsRawFd;
10994
use crate::os::unix::net::UnixStream;
110-
use libc::{c_void, getpeereid, getsockopt, pid_t, socklen_t, SOL_LOCAL, LOCAL_PEERPID};
95+
use crate::{io, mem};
96+
use libc::{c_void, getpeereid, getsockopt, pid_t, socklen_t, LOCAL_PEERPID, SOL_LOCAL};
11197

11298
pub fn peer_cred(socket: &UnixStream) -> io::Result<UCred> {
11399
let mut cred = UCred { uid: 1, gid: 1, pid: None };
@@ -126,7 +112,7 @@ pub mod impl_mac {
126112
SOL_LOCAL,
127113
LOCAL_PEERPID,
128114
&mut pid as *mut pid_t as *mut c_void,
129-
&mut pid_size
115+
&mut pid_size,
130116
);
131117

132118
if ret == 0 && pid_size as usize == mem::size_of::<pid_t>() {

library/std/src/sys/unix/ext/ucred/tests.rs

+1-5
Original file line numberDiff line numberDiff line change
@@ -25,11 +25,7 @@ fn test_socket_pair() {
2525
}
2626

2727
#[test]
28-
#[cfg(any(
29-
target_os = "linux",
30-
target_os = "ios",
31-
target_os = "macos",
32-
))]
28+
#[cfg(any(target_os = "linux", target_os = "ios", target_os = "macos",))]
3329
fn test_socket_pair_pids(arg: Type) -> RetType {
3430
// Create two connected sockets and get their peer credentials.
3531
let (sock_a, sock_b) = UnixStream::pair().unwrap();

0 commit comments

Comments
 (0)