@@ -28,17 +28,10 @@ pub struct UCred {
28
28
#[ cfg( any( target_os = "android" , target_os = "linux" ) ) ]
29
29
pub use self :: impl_linux:: peer_cred;
30
30
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" ) ) ]
36
32
pub use self :: impl_bsd:: peer_cred;
37
33
38
- #[ cfg( any(
39
- target_os = "macos" ,
40
- target_os = "ios" ,
41
- ) ) ]
34
+ #[ cfg( any( target_os = "macos" , target_os = "ios" , ) ) ]
42
35
pub use self :: impl_mac:: peer_cred;
43
36
44
37
#[ cfg( any( target_os = "linux" , target_os = "android" ) ) ]
@@ -77,11 +70,7 @@ pub mod impl_linux {
77
70
}
78
71
}
79
72
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" ) ) ]
85
74
pub mod impl_bsd {
86
75
use super :: UCred ;
87
76
use crate :: io;
@@ -98,16 +87,13 @@ pub mod impl_bsd {
98
87
}
99
88
}
100
89
101
- #[ cfg( any(
102
- target_os = "macos" ,
103
- target_os = "ios" ,
104
- ) ) ]
90
+ #[ cfg( any( target_os = "macos" , target_os = "ios" , ) ) ]
105
91
pub mod impl_mac {
106
92
use super :: UCred ;
107
- use crate :: { io, mem} ;
108
93
use crate :: os:: unix:: io:: AsRawFd ;
109
94
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 } ;
111
97
112
98
pub fn peer_cred ( socket : & UnixStream ) -> io:: Result < UCred > {
113
99
let mut cred = UCred { uid : 1 , gid : 1 , pid : None } ;
@@ -126,7 +112,7 @@ pub mod impl_mac {
126
112
SOL_LOCAL ,
127
113
LOCAL_PEERPID ,
128
114
& mut pid as * mut pid_t as * mut c_void ,
129
- & mut pid_size
115
+ & mut pid_size,
130
116
) ;
131
117
132
118
if ret == 0 && pid_size as usize == mem:: size_of :: < pid_t > ( ) {
0 commit comments