From 1058db371684c729763d8f959f6c48203711e775 Mon Sep 17 00:00:00 2001 From: Jeremy Wall Date: Thu, 24 Dec 2020 23:35:17 -0500 Subject: [PATCH] Cleanup unused warnings --- src/icmp.rs | 2 +- src/main.rs | 2 +- src/util.rs | 22 ++-------------------- 3 files changed, 4 insertions(+), 22 deletions(-) diff --git a/src/icmp.rs b/src/icmp.rs index 5e81008..8c053f5 100644 --- a/src/icmp.rs +++ b/src/icmp.rs @@ -71,7 +71,7 @@ pub fn start_echo_loop( .with(&prometheus::labels! {"domain" => domain_name}) .set(r.elapsed.as_millis() as i64); } - EkkoResponse::ExceededResponse(r) => { + EkkoResponse::ExceededResponse(_) => { ping_counter .with(&prometheus::labels! {"result" => "timedout", "domain" => domain_name}) .inc(); diff --git a/src/main.rs b/src/main.rs index 89e86a3..aba99f9 100644 --- a/src/main.rs +++ b/src/main.rs @@ -179,7 +179,7 @@ fn main() -> anyhow::Result<()> { }); parent.adopt(Box::new(render_thread)); } - for (i, domain_name) in ping_hosts.iter().cloned().enumerate() { + for domain_name in ping_hosts.iter().cloned() { // TODO(Prometheus stats) let stop_signal = stop_signal.clone(); let ping_latency_vec = ping_latency_vec.clone(); diff --git a/src/util.rs b/src/util.rs index dac4eb7..3db6cb4 100644 --- a/src/util.rs +++ b/src/util.rs @@ -13,7 +13,7 @@ // limitations under the License. use std::io; -use std::net::{IpAddr, SocketAddr, ToSocketAddrs}; +use std::net::{SocketAddr, ToSocketAddrs}; use log::info; @@ -30,22 +30,4 @@ pub fn resolve_addrs<'a>(servers: &'a Vec<&str>) -> io::Result) -> io::Result>> { - let mut results = Vec::with_capacity(hosts.len()); - // NOTE(jwall): This is a silly hack due to the fact that the proper way - // to do host lookups in the Rust stdlib has not settled yet. - // TODO(jwall): Do this in a less hacky method once host lookups - // are settled properly. - for host in hosts.iter().cloned() { - match format!("{}:8080", host).to_socket_addrs() { - Ok(addr) => results.push(addr.into_iter().next().map(|a| a.ip())), - Err(e) => { - info!("Failed to resolve {} with error {}", host, e); - results.push(None); - } - } - } - Ok(results) -} +} \ No newline at end of file