Cleanup unused warnings

This commit is contained in:
Jeremy Wall 2020-12-24 23:35:17 -05:00
parent 5a47c31152
commit 1058db3716
3 changed files with 4 additions and 22 deletions

View File

@ -71,7 +71,7 @@ pub fn start_echo_loop(
.with(&prometheus::labels! {"domain" => domain_name}) .with(&prometheus::labels! {"domain" => domain_name})
.set(r.elapsed.as_millis() as i64); .set(r.elapsed.as_millis() as i64);
} }
EkkoResponse::ExceededResponse(r) => { EkkoResponse::ExceededResponse(_) => {
ping_counter ping_counter
.with(&prometheus::labels! {"result" => "timedout", "domain" => domain_name}) .with(&prometheus::labels! {"result" => "timedout", "domain" => domain_name})
.inc(); .inc();

View File

@ -179,7 +179,7 @@ fn main() -> anyhow::Result<()> {
}); });
parent.adopt(Box::new(render_thread)); 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) // TODO(Prometheus stats)
let stop_signal = stop_signal.clone(); let stop_signal = stop_signal.clone();
let ping_latency_vec = ping_latency_vec.clone(); let ping_latency_vec = ping_latency_vec.clone();

View File

@ -13,7 +13,7 @@
// limitations under the License. // limitations under the License.
use std::io; use std::io;
use std::net::{IpAddr, SocketAddr, ToSocketAddrs}; use std::net::{SocketAddr, ToSocketAddrs};
use log::info; use log::info;
@ -30,22 +30,4 @@ pub fn resolve_addrs<'a>(servers: &'a Vec<&str>) -> io::Result<Vec<Option<Socket
} }
} }
return Ok(results); return Ok(results);
} }
pub fn resolve_ip_addrs(hosts: &Vec<&str>) -> io::Result<Vec<Option<IpAddr>>> {
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)
}