From 001759afac58b82e621beba10808a9dee04b2cc3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=CE=A3rebe=20-=20Romain=20GERARD?= Date: Tue, 19 Dec 2023 23:16:06 +0100 Subject: [PATCH] cleanup --- src/dns.rs | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/src/dns.rs b/src/dns.rs index a1e649a..8c6554a 100644 --- a/src/dns.rs +++ b/src/dns.rs @@ -1,4 +1,3 @@ -use anyhow::Context; use hickory_resolver::TokioAsyncResolver; use std::net::{IpAddr, SocketAddr, SocketAddrV4, SocketAddrV6}; @@ -12,13 +11,11 @@ impl DnsResolver { pub async fn lookup_host(&self, domain: &str, port: u16) -> anyhow::Result> { let addrs: Vec = match self { DnsResolver::System => tokio::net::lookup_host(format!("{}:{}", domain, port)) - .await - .with_context(|| format!("cannot resolve domain: {}", domain))? + .await? .collect(), DnsResolver::TrustDns(dns_resolver) => dns_resolver .lookup_ip(domain) - .await - .with_context(|| format!("cannot resolve domain: {}", domain))? + .await? .into_iter() .map(|ip| match ip { IpAddr::V4(ip) => SocketAddr::V4(SocketAddrV4::new(ip, port)),