mirror of
https://github.com/fluencelabs/rust-libp2p
synced 2025-07-31 17:01:58 +00:00
*: Fix various clippy warnings (#2900)
This commit is contained in:
@@ -85,7 +85,7 @@ where
|
||||
socket.bind(&SocketAddr::new(IpAddr::V4(Ipv4Addr::UNSPECIFIED), 5353).into())?;
|
||||
socket.set_multicast_loop_v4(true)?;
|
||||
socket.set_multicast_ttl_v4(255)?;
|
||||
socket.join_multicast_v4(&*crate::IPV4_MDNS_MULTICAST_ADDRESS, &addr)?;
|
||||
socket.join_multicast_v4(&crate::IPV4_MDNS_MULTICAST_ADDRESS, &addr)?;
|
||||
U::from_std(UdpSocket::from(socket))?
|
||||
}
|
||||
IpAddr::V6(_) => {
|
||||
@@ -96,7 +96,7 @@ where
|
||||
socket.bind(&SocketAddr::new(IpAddr::V6(Ipv6Addr::UNSPECIFIED), 5353).into())?;
|
||||
socket.set_multicast_loop_v6(true)?;
|
||||
// TODO: find interface matching addr.
|
||||
socket.join_multicast_v6(&*crate::IPV6_MDNS_MULTICAST_ADDRESS, 0)?;
|
||||
socket.join_multicast_v6(&crate::IPV6_MDNS_MULTICAST_ADDRESS, 0)?;
|
||||
U::from_std(UdpSocket::from(socket))?
|
||||
}
|
||||
};
|
||||
|
@@ -246,7 +246,7 @@ fn query_response_packet(id: u16, peer_id: &[u8], records: &[Vec<u8>], ttl: u32)
|
||||
fn duration_to_secs(duration: Duration) -> u32 {
|
||||
let secs = duration
|
||||
.as_secs()
|
||||
.saturating_add(if duration.subsec_nanos() > 0 { 1 } else { 0 });
|
||||
.saturating_add(u64::from(duration.subsec_nanos() > 0));
|
||||
cmp::min(secs, From::from(u32::max_value())) as u32
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user