Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Import cleanup #193

Merged
merged 1 commit into from
Dec 10, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 9 additions & 9 deletions mtop-client/src/dns/client.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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};
Expand Down Expand Up @@ -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
Expand All @@ -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
Expand Down Expand Up @@ -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 {{ ... }}")
}
}
Expand Down Expand Up @@ -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 {{ ... }}")
}
}
Expand Down
3 changes: 1 addition & 2 deletions mtop-client/src/dns/core.rs
Original file line number Diff line number Diff line change
@@ -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)]
Expand Down
5 changes: 2 additions & 3 deletions mtop-client/src/dns/message.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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)]
Expand Down Expand Up @@ -34,7 +33,7 @@ impl From<MessageId> 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)
}
}
Expand Down
3 changes: 1 addition & 2 deletions mtop-client/src/dns/name.rs
Original file line number Diff line number Diff line change
@@ -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;

Expand Down
4 changes: 2 additions & 2 deletions mtop-client/src/dns/rdata.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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};

Expand Down Expand Up @@ -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))
}
}
Expand Down
3 changes: 1 addition & 2 deletions mtop/src/tracing.rs
Original file line number Diff line number Diff line change
@@ -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;
Expand Down
Loading