Skip to content

Commit 62ad90a

Browse files
authored
Fix a clippy::unnecessary_cast lint on the latest nightly (#2472)
The Ipv4Ttl control message has a different size on Linux than on FreeBSD, and needs to be cast differently.
1 parent 8e74bb4 commit 62ad90a

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

src/sys/socket/mod.rs

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1346,9 +1346,12 @@ impl<'a> ControlMessage<'a> {
13461346
#[cfg(any(freebsdlike, netbsdlike))]
13471347
#[cfg(feature = "net")]
13481348
ControlMessage::Ipv4SendSrcAddr(addr) => addr as *const _ as *const u8,
1349-
#[cfg(any(linux_android, target_os = "freebsd"))]
1349+
#[cfg(linux_android)]
1350+
#[cfg(feature = "net")]
1351+
ControlMessage::Ipv4Ttl(ttl) => ttl as *const i32 as *const u8,
1352+
#[cfg(target_os = "freebsd")]
13501353
#[cfg(feature = "net")]
1351-
ControlMessage::Ipv4Ttl(ttl) => ttl as *const _ as *const u8,
1354+
ControlMessage::Ipv4Ttl(ttl) => ttl as *const u8,
13521355
#[cfg(any(linux_android, freebsdlike, apple_targets, target_os = "haiku"))]
13531356
#[cfg(feature = "net")]
13541357
ControlMessage::Ipv6HopLimit(limit) => limit as *const _ as *const u8,

0 commit comments

Comments
 (0)