1 Commits

Author SHA1 Message Date
de31eeef7a Format Rust code using rustfmt 2025-06-27 11:15:08 +00:00

View File

@ -210,8 +210,9 @@ fn main() {
// Do DNS resolution in parallel but store results for ordered display later // Do DNS resolution in parallel but store results for ordered display later
let resolved_ips_with_indices = Arc::new(Mutex::new(Vec::<(String, IpAddr, usize)>::new())); let resolved_ips_with_indices = Arc::new(Mutex::new(Vec::<(String, IpAddr, usize)>::new()));
host_with_indices.par_iter().for_each(|(host, idx)| { host_with_indices
match lookup_host(&host.name) { .par_iter()
.for_each(|(host, idx)| match lookup_host(&host.name) {
Ok(ips) if !ips.is_empty() => { Ok(ips) if !ips.is_empty() => {
let ip = ips[0]; let ip = ips[0];
let mut results = resolved_ips_with_indices.lock().unwrap(); let mut results = resolved_ips_with_indices.lock().unwrap();
@ -219,12 +220,19 @@ fn main() {
} }
Ok(_) => { Ok(_) => {
let mut results = resolved_ips_with_indices.lock().unwrap(); let mut results = resolved_ips_with_indices.lock().unwrap();
results.push((host.name.clone(), IpAddr::V4(std::net::Ipv4Addr::new(0, 0, 0, 0)), *idx)); results.push((
host.name.clone(),
IpAddr::V4(std::net::Ipv4Addr::new(0, 0, 0, 0)),
*idx,
));
} }
Err(_) => { Err(_) => {
let mut results = resolved_ips_with_indices.lock().unwrap(); let mut results = resolved_ips_with_indices.lock().unwrap();
results.push((host.name.clone(), IpAddr::V4(std::net::Ipv4Addr::new(0, 0, 0, 0)), *idx)); results.push((
} host.name.clone(),
IpAddr::V4(std::net::Ipv4Addr::new(0, 0, 0, 0)),
*idx,
));
} }
}); });