1

Appease clippy

This commit is contained in:
Evan Pratten 2023-08-04 19:30:12 -04:00
parent 23fd3f2271
commit 2486aac690
2 changed files with 4 additions and 5 deletions

View File

@ -154,9 +154,8 @@ impl CrossProtocolNetworkAddressTableWithIpv4Pool {
let new_address = self let new_address = self
.pool .pool
.iter() .iter()
.map(|prefix| prefix.hosts()) .flat_map(Ipv4Net::hosts)
.flatten() .find(|addr| self.table.get_ipv6(addr).is_none())
.find(|addr| !self.table.get_ipv6(addr).is_some())
.ok_or(Error::Ipv4PoolExhausted)?; .ok_or(Error::Ipv4PoolExhausted)?;
// Insert the new mapping // Insert the new mapping

View File

@ -171,7 +171,7 @@ pub async fn main() {
Some(new_destination) => Ok(translate_ipv4_to_ipv6( Some(new_destination) => Ok(translate_ipv4_to_ipv6(
packet, packet,
unsafe { embed_ipv4_addr_unchecked(*source, args.translation_prefix) }, unsafe { embed_ipv4_addr_unchecked(*source, args.translation_prefix) },
new_destination.into(), new_destination,
) )
.map(Some)?), .map(Some)?),
None => { None => {
@ -183,7 +183,7 @@ pub async fn main() {
|packet, source, dest| { |packet, source, dest| {
Ok(translate_ipv6_to_ipv4( Ok(translate_ipv6_to_ipv4(
packet, packet,
addr_table.borrow_mut().get_or_create_ipv4(source)?.into(), addr_table.borrow_mut().get_or_create_ipv4(source)?,
unsafe { unsafe {
extract_ipv4_addr_unchecked(*dest, args.translation_prefix.prefix_len()) extract_ipv4_addr_unchecked(*dest, args.translation_prefix.prefix_len())
}, },