diff --git a/iroh-net/src/dns.rs b/iroh-net/src/dns.rs index 96eb6268d6..c351710ea4 100644 --- a/iroh-net/src/dns.rs +++ b/iroh-net/src/dns.rs @@ -1,6 +1,7 @@ //! This module exports a DNS resolver, which is also the default resolver used in the //! [`crate::Endpoint`] if no custom resolver is configured. +use std::fmt::Write; use std::net::{IpAddr, Ipv6Addr}; use std::time::Duration; @@ -337,10 +338,10 @@ async fn stagger_call Fut, Fut: Future>>( anyhow::bail!( "no calls succeed: [ {}]", - errors - .into_iter() - .map(|e| format!("{e} ")) - .collect::() + errors.into_iter().fold(String::new(), |mut summary, e| { + write!(summary, "{e} ").expect("infallible"); + summary + }) ) }