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

style: simplify some statements for readability #72

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
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
14 changes: 6 additions & 8 deletions src/tcp2udp.rs
Original file line number Diff line number Diff line change
Expand Up @@ -108,12 +108,10 @@ impl fmt::Display for Tcp2UdpError {
CreateTcpSocket(_) => "Failed to create TCP socket".fmt(f),
ApplyTcpOptions(_) => "Failed to apply options to TCP socket".fmt(f),
SetReuseAddr(_) => "Failed to set SO_REUSEADDR on TCP socket".fmt(f),
BindTcpSocket(_, addr) => write!(f, "Failed to bind TCP socket to {}", addr),
ListenTcpSocket(_, addr) => write!(
f,
"Failed to start listening on TCP socket bound to {}",
addr
),
BindTcpSocket(_, addr) => write!(f, "Failed to bind TCP socket to {addr}"),
ListenTcpSocket(_, addr) => {
write!(f, "Failed to start listening on TCP socket bound to {addr}")
}
#[cfg(feature = "statsd")]
CreateStatsdClient(_) => "Failed to init metrics client".fmt(f),
}
Expand Down Expand Up @@ -275,11 +273,11 @@ async fn process_socket(

let udp_socket = UdpSocket::bind(udp_bind_addr)
.await
.with_context(|_| format!("Failed to bind UDP socket to {}", udp_bind_addr))?;
.with_context(|_| format!("Failed to bind UDP socket to {udp_bind_addr}"))?;
udp_socket
.connect(udp_peer_addr)
.await
.with_context(|_| format!("Failed to connect UDP socket to {}", udp_peer_addr))?;
.with_context(|_| format!("Failed to connect UDP socket to {udp_peer_addr}"))?;

log::debug!(
"UDP socket bound to {} and connected to {}",
Expand Down