diff --git a/mtop-client/src/dns/client.rs b/mtop-client/src/dns/client.rs index c3911cb..09233ce 100644 --- a/mtop-client/src/dns/client.rs +++ b/mtop-client/src/dns/client.rs @@ -5,7 +5,7 @@ use crate::dns::name::Name; use crate::net::tcp_connect; use crate::pool::{ClientFactory, ClientPool, ClientPoolConfig}; use crate::timeout::Timeout; -use std::fmt::{self, Formatter}; +use std::fmt; use std::future::Future; use std::io::{self, Cursor, Error}; use std::net::{IpAddr, Ipv4Addr, SocketAddr}; @@ -122,10 +122,10 @@ where let server = self.nameserver(attempt); let res = async { - let mut client = self.udp_pool.get(&server).await?; - let res = client.exchange(msg).await; + let mut conn = self.udp_pool.get(&server).await?; + let res = conn.exchange(msg).await; if res.is_ok() { - self.udp_pool.put(client).await; + self.udp_pool.put(conn).await; } res @@ -138,10 +138,10 @@ where if res.flags().is_truncated() { tracing::debug!(message = "UDP response truncated, retrying with TCP", flags = ?res.flags(), server = %server); async { - let mut client = self.tcp_pool.get(&server).await?; - let res = client.exchange(msg).await; + let mut conn = self.tcp_pool.get(&server).await?; + let res = conn.exchange(msg).await; if res.is_ok() { - self.tcp_pool.put(client).await; + self.tcp_pool.put(conn).await; } res @@ -265,7 +265,7 @@ impl TcpConnection { } impl fmt::Debug for TcpConnection { - fn fmt(&self, f: &mut Formatter<'_>) -> fmt::Result { + fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { write!(f, "TcpConnection {{ ... }}") } } @@ -326,7 +326,7 @@ impl UdpConnection { } impl fmt::Debug for UdpConnection { - fn fmt(&self, f: &mut Formatter<'_>) -> fmt::Result { + fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { write!(f, "UdpConnection {{ ... }}") } } diff --git a/mtop-client/src/dns/core.rs b/mtop-client/src/dns/core.rs index 867597f..2e26f3a 100644 --- a/mtop-client/src/dns/core.rs +++ b/mtop-client/src/dns/core.rs @@ -1,6 +1,5 @@ use crate::core::MtopError; -use std::fmt; -use std::fmt::Display; +use std::fmt::{self, Display}; use std::str::FromStr; #[derive(Debug, Copy, Clone, Eq, PartialEq)] diff --git a/mtop-client/src/dns/message.rs b/mtop-client/src/dns/message.rs index 10c61c2..92dde61 100644 --- a/mtop-client/src/dns/message.rs +++ b/mtop-client/src/dns/message.rs @@ -3,8 +3,7 @@ use crate::dns::core::{RecordClass, RecordType}; use crate::dns::name::Name; use crate::dns::rdata::RecordData; use byteorder::{NetworkEndian, ReadBytesExt, WriteBytesExt}; -use std::fmt; -use std::fmt::{Debug, Formatter}; +use std::fmt::{self, Debug}; use std::io::Seek; #[derive(Debug, Copy, Clone, Eq, PartialEq, Hash)] @@ -34,7 +33,7 @@ impl From for u16 { } impl fmt::Display for MessageId { - fn fmt(&self, f: &mut Formatter<'_>) -> fmt::Result { + fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { write!(f, "{}", self.0) } } diff --git a/mtop-client/src/dns/name.rs b/mtop-client/src/dns/name.rs index dc64ebd..a7306b2 100644 --- a/mtop-client/src/dns/name.rs +++ b/mtop-client/src/dns/name.rs @@ -1,7 +1,6 @@ use crate::core::MtopError; use byteorder::{ReadBytesExt, WriteBytesExt}; -use std::fmt; -use std::fmt::Display; +use std::fmt::{self, Display}; use std::io::{Read, Seek, SeekFrom}; use std::str::FromStr; diff --git a/mtop-client/src/dns/rdata.rs b/mtop-client/src/dns/rdata.rs index 86cef11..f23eaa7 100644 --- a/mtop-client/src/dns/rdata.rs +++ b/mtop-client/src/dns/rdata.rs @@ -2,7 +2,7 @@ use crate::core::MtopError; use crate::dns::core::RecordType; use crate::dns::name::Name; use byteorder::{BigEndian, NetworkEndian, ReadBytesExt, WriteBytesExt}; -use std::fmt::{self, Display, Formatter}; +use std::fmt::{self, Display}; use std::io::{Read, Seek}; use std::net::{Ipv4Addr, Ipv6Addr}; @@ -571,7 +571,7 @@ impl RecordDataOptPair { } impl Display for RecordDataOptPair { - fn fmt(&self, f: &mut Formatter<'_>) -> fmt::Result { + fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { write!(f, "{}: {}", self.code, String::from_utf8_lossy(&self.data)) } } diff --git a/mtop/src/tracing.rs b/mtop/src/tracing.rs index 2df0595..3eabdfb 100644 --- a/mtop/src/tracing.rs +++ b/mtop/src/tracing.rs @@ -1,5 +1,4 @@ -use std::fs; -use std::fs::File; +use std::fs::{self, File}; use std::io::{self, Stderr}; use std::path::PathBuf; use tracing::level_filters::LevelFilter;