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) => { res = sock.recv(&mut buf_tcp) => {
match res { match res {
Some(size) => { Some(size) => {
if size > 0 { if size > 0
if let Err(e) = udp_sock.send(&buf_tcp[..size]).await { && let Err(e) = udp_sock.send(&buf_tcp[..size]).await {
error!("Unable to send UDP packet to {}: {}, closing connection", e, addr); error!("Unable to send UDP packet to {}: {}, closing connection", e, addr);
quit.cancel(); quit.cancel();
return; return;
} }
}
}, },
None => { None => {
debug!("removed fake TCP socket from connections table"); 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) => { res = sock.recv(&mut buf_tcp) => {
match res { match res {
Some(size) => { Some(size) => {
if size > 0 { if size > 0
if let Err(e) = udp_sock.send(&buf_tcp[..size]).await { && let Err(e) = udp_sock.send(&buf_tcp[..size]).await {
error!("Unable to send UDP packet to {}: {}, closing connection", e, remote_addr); error!("Unable to send UDP packet to {}: {}, closing connection", e, remote_addr);
quit.cancel(); quit.cancel();
return; return;
} }
}
}, },
None => { None => {
quit.cancel(); quit.cancel();