Skip to content

Commit e61148f

Browse files
committed
Cast boolean into int directly in function set_passcred
1 parent d0b133c commit e61148f

File tree

1 file changed

+1
-2
lines changed
  • library/std/src/sys/unix

1 file changed

+1
-2
lines changed

library/std/src/sys/unix/net.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -324,8 +324,7 @@ impl Socket {
324324
}
325325

326326
pub fn set_passcred(&self, passcred: bool) -> io::Result<()> {
327-
let boolean: libc::c_int = if passcred { 1 } else { 0 };
328-
setsockopt(self, libc::SOL_SOCKET, libc::SO_PASSCRED, boolean)
327+
setsockopt(self, libc::SOL_SOCKET, libc::SO_PASSCRED, passcred as libc::c_int)
329328
}
330329

331330
pub fn passcred(&self) -> io::Result<bool> {

0 commit comments

Comments
 (0)