style(phantun): use Rust 2024 && combination for if let

This commit is contained in:
Datong Sun 2025-08-22 09:17:07 -07:00
parent 86133609da
commit 77b2c41518
2 changed files with 4 additions and 6 deletions

View File

@ -245,13 +245,12 @@ async fn main() -> io::Result<()> {
res = sock.recv(&mut buf_tcp) => {
match res {
Some(size) => {
if size > 0 {
if let Err(e) = udp_sock.send(&buf_tcp[..size]).await {
if size > 0
&& let Err(e) = udp_sock.send(&buf_tcp[..size]).await {
error!("Unable to send UDP packet to {}: {}, closing connection", e, addr);
quit.cancel();
return;
}
}
},
None => {
debug!("removed fake TCP socket from connections table");

View File

@ -219,13 +219,12 @@ async fn main() -> io::Result<()> {
res = sock.recv(&mut buf_tcp) => {
match res {
Some(size) => {
if size > 0 {
if let Err(e) = udp_sock.send(&buf_tcp[..size]).await {
if size > 0
&& let Err(e) = udp_sock.send(&buf_tcp[..size]).await {
error!("Unable to send UDP packet to {}: {}, closing connection", e, remote_addr);
quit.cancel();
return;
}
}
},
None => {
quit.cancel();