Skip to content

Commit a961449

Browse files
JohnTitorThomasdezeeuw
authored andcommitted
Fix a clippy warning
Signed-off-by: Yuki Okushi <[email protected]>
1 parent 61314a2 commit a961449

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

src/socket.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1445,7 +1445,7 @@ impl Socket {
14451445
target_os = "solaris",
14461446
)))]
14471447
pub fn set_recv_tos(&self, recv_tos: bool) -> io::Result<()> {
1448-
let recv_tos = if recv_tos { 1 } else { 0 };
1448+
let recv_tos = i32::from(recv_tos);
14491449

14501450
unsafe {
14511451
setsockopt(

tests/socket.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1043,7 +1043,7 @@ fn cpu_affinity() {
10431043

10441044
// NOTE: This requires at least 2 CPU cores.
10451045
let cpu = socket.cpu_affinity().unwrap();
1046-
let want = if cpu == 0 { 1 } else { 0 };
1046+
let want = usize::from(cpu == 0);
10471047

10481048
socket.set_cpu_affinity(want).unwrap();
10491049
assert_eq!(socket.cpu_affinity().unwrap(), want);

0 commit comments

Comments
 (0)