Format Rust code using rustfmt

This commit is contained in:
github-actions[bot]
2025-06-27 11:15:08 +00:00
committed by GitHub
parent aea2a927c2
commit de31eeef7a

View File

@ -210,8 +210,9 @@ fn main() {
// 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()));
host_with_indices.par_iter().for_each(|(host, idx)| {
match lookup_host(&host.name) {
host_with_indices
.par_iter()
.for_each(|(host, idx)| match lookup_host(&host.name) {
Ok(ips) if !ips.is_empty() => {
let ip = ips[0];
let mut results = resolved_ips_with_indices.lock().unwrap();
@ -219,14 +220,21 @@ fn main() {
}
Ok(_) => {
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(_) => {
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,
));
}
}
});
});
// Sort by original index to ensure hosts are displayed in order
let mut resolved_hosts = resolved_ips_with_indices.lock().unwrap().clone();