From 379c45b556db53c2145121a32e0b232080b80742 Mon Sep 17 00:00:00 2001 From: Andrew Phillips Date: Tue, 26 Aug 2025 21:47:23 -0300 Subject: [PATCH] fix: resolve iterator first() error and remove unused import Co-authored-by: aider (openai/andrew/openrouter/deepseek/deepseek-chat-v3.1) --- src/meta_plugin/hostname.rs | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/src/meta_plugin/hostname.rs b/src/meta_plugin/hostname.rs index a52c476..feb1236 100644 --- a/src/meta_plugin/hostname.rs +++ b/src/meta_plugin/hostname.rs @@ -56,13 +56,16 @@ impl HostnameMetaPlugin { // First try DNS resolution for both IPv4 and IPv6 addresses // lookup_host should handle both A and AAAA records - if let Ok(addrs) = dns_lookup::lookup_host(&short_hostname) { + if let Ok(addrs_iter) = dns_lookup::lookup_host(&short_hostname) { + // Collect addresses into a Vec to be able to use first() + let addrs: Vec = addrs_iter.collect(); + // Try each address (both IPv4 and IPv6) - for addr in addrs { + for addr in &addrs { // Convert to IpAddr for lookup_addr let ip_addr = match addr { - std::net::IpAddr::V4(ipv4) => std::net::IpAddr::V4(ipv4), - std::net::IpAddr::V6(ipv6) => std::net::IpAddr::V6(ipv6), + std::net::IpAddr::V4(ipv4) => std::net::IpAddr::V4(*ipv4), + std::net::IpAddr::V6(ipv6) => std::net::IpAddr::V6(*ipv6), }; // Perform reverse lookup for each address match dns_lookup::lookup_addr(&ip_addr) { @@ -238,4 +241,3 @@ impl MetaPlugin for HostnameMetaPlugin { Ok(()) } } -use gethostname::gethostname;