From 02c0f0963fd52c4559733eba252277cf24c5548b Mon Sep 17 00:00:00 2001 From: dev0 Date: Mon, 23 Sep 2024 23:44:01 +1000 Subject: [PATCH] f --- clash_lib/src/proxy/shadowsocks/datagram.rs | 8 ++++---- clash_lib/src/proxy/tun/mod.rs | 4 ++-- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/clash_lib/src/proxy/shadowsocks/datagram.rs b/clash_lib/src/proxy/shadowsocks/datagram.rs index ed746e4e5..d422b5667 100644 --- a/clash_lib/src/proxy/shadowsocks/datagram.rs +++ b/clash_lib/src/proxy/shadowsocks/datagram.rs @@ -237,9 +237,9 @@ impl DatagramSend for ShadowsocksUdpIo { match w.poll_flush_unpin(cx) { Poll::Ready(Ok(())) => Poll::Ready(Ok(buf.len())), Poll::Ready(Err(e)) => { - return Poll::Ready(Err(new_io_error(e.to_string()))) + Poll::Ready(Err(new_io_error(e.to_string()))) } - Poll::Pending => return Poll::Pending, + Poll::Pending => Poll::Pending, } } @@ -275,8 +275,8 @@ impl DatagramReceive for ShadowsocksUdpIo { } Poll::Ready(Ok(())) } - Poll::Pending => return Poll::Pending, - Poll::Ready(None) => return Poll::Ready(Ok(())), + Poll::Pending => Poll::Pending, + Poll::Ready(None) => Poll::Ready(Ok(())), } } } diff --git a/clash_lib/src/proxy/tun/mod.rs b/clash_lib/src/proxy/tun/mod.rs index 54de9084f..3693292a4 100644 --- a/clash_lib/src/proxy/tun/mod.rs +++ b/clash_lib/src/proxy/tun/mod.rs @@ -87,7 +87,7 @@ mod tests { let log_path = cwd + "/" + &log_file + "." + &today.to_string(); let logs = std::fs::read_to_string(&log_path) - .expect(format!("failed to read log file: {}", log_path).as_str()); + .unwrap_or_else(|_| panic!("failed to read log file: {}", log_path)); assert!(logs.contains("1.1.1.1:53 to MATCH")); @@ -161,7 +161,7 @@ mod tests { let log_path = cwd + "/" + &log_file + "." + &today.to_string(); let logs = std::fs::read_to_string(&log_path) - .expect(format!("failed to read log file: {}", log_path).as_str()); + .unwrap_or_else(|_| panic!("failed to read log file: {}", log_path)); assert!(logs.contains("route_all is enabled")); assert!(logs.contains(format!("{} to MATCH", echo_addr).as_str()));