Skip to content

Commit

Permalink
Fix a clippy::unnecessary_cast lint on the latest nightly (#2472)
Browse files Browse the repository at this point in the history
The Ipv4Ttl control message has a different size on Linux than on
FreeBSD, and needs to be cast differently.
  • Loading branch information
asomers authored Aug 23, 2024
1 parent 8e74bb4 commit 62ad90a
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions src/sys/socket/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1346,9 +1346,12 @@ impl<'a> ControlMessage<'a> {
#[cfg(any(freebsdlike, netbsdlike))]
#[cfg(feature = "net")]
ControlMessage::Ipv4SendSrcAddr(addr) => addr as *const _ as *const u8,
#[cfg(any(linux_android, target_os = "freebsd"))]
#[cfg(linux_android)]
#[cfg(feature = "net")]
ControlMessage::Ipv4Ttl(ttl) => ttl as *const i32 as *const u8,
#[cfg(target_os = "freebsd")]
#[cfg(feature = "net")]
ControlMessage::Ipv4Ttl(ttl) => ttl as *const _ as *const u8,
ControlMessage::Ipv4Ttl(ttl) => ttl as *const u8,
#[cfg(any(linux_android, freebsdlike, apple_targets, target_os = "haiku"))]
#[cfg(feature = "net")]
ControlMessage::Ipv6HopLimit(limit) => limit as *const _ as *const u8,
Expand Down

0 comments on commit 62ad90a

Please sign in to comment.