From b4487c2272e379e24e0dcb8edc27285716d98501 Mon Sep 17 00:00:00 2001 From: imspace Date: Wed, 2 Oct 2024 16:03:26 +0800 Subject: [PATCH] fix: cargo check warnings --- .cargo/{config => config.toml} | 0 protocol/obfs/src/http_simple.rs | 12 ------------ rabbit-digger/src/rabbit_digger/event.rs | 2 ++ rd-std/src/builtin/resolve.rs | 1 - rd-std/src/rule/rule_net.rs | 1 + rd-std/src/transparent.rs | 1 + rd-std/src/transparent/origin_addr.rs | 2 -- 7 files changed, 4 insertions(+), 15 deletions(-) rename .cargo/{config => config.toml} (100%) diff --git a/.cargo/config b/.cargo/config.toml similarity index 100% rename from .cargo/config rename to .cargo/config.toml diff --git a/protocol/obfs/src/http_simple.rs b/protocol/obfs/src/http_simple.rs index 66f95f38..1c10995f 100644 --- a/protocol/obfs/src/http_simple.rs +++ b/protocol/obfs/src/http_simple.rs @@ -1,4 +1,3 @@ -use core::fmt; use std::{ io::{self, Cursor, Write}, pin::Pin, @@ -81,17 +80,6 @@ impl Connect { } } -struct UrlEncode<'a>(&'a [u8]); - -impl<'a> fmt::Display for UrlEncode<'a> { - fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { - for i in self.0 { - write!(f, "%{:02x}", i)?; - } - Ok(()) - } -} - #[async_trait] impl ITcpStream for Connect { async fn peer_addr(&self) -> Result { diff --git a/rabbit-digger/src/rabbit_digger/event.rs b/rabbit-digger/src/rabbit_digger/event.rs index 78541535..c8e1fea3 100644 --- a/rabbit-digger/src/rabbit_digger/event.rs +++ b/rabbit-digger/src/rabbit_digger/event.rs @@ -13,7 +13,9 @@ pub enum EventType { CloseConnection, Write(u64), Read(u64), + #[allow(dead_code)] SendTo(Address, u64), + #[allow(dead_code)] RecvFrom(Address, u64), } diff --git a/rd-std/src/builtin/resolve.rs b/rd-std/src/builtin/resolve.rs index c756f8c6..4f81d3ed 100644 --- a/rd-std/src/builtin/resolve.rs +++ b/rd-std/src/builtin/resolve.rs @@ -10,7 +10,6 @@ use rd_interface::{ type Resolver = Arc BoxFuture<'static, io::Result>> + Send + Sync>; -pub struct Udp(UdpSocket, Resolver); // Resolves domain names to IP addresses before connecting. #[rd_config] diff --git a/rd-std/src/rule/rule_net.rs b/rd-std/src/rule/rule_net.rs index 2327e62b..02757642 100644 --- a/rd-std/src/rule/rule_net.rs +++ b/rd-std/src/rule/rule_net.rs @@ -11,6 +11,7 @@ use rd_interface::{ use tracing::instrument; pub struct RuleItem { + #[allow(dead_code)] pub target_name: String, pub target: Net, matcher: config::Matcher, diff --git a/rd-std/src/transparent.rs b/rd-std/src/transparent.rs index cedc585a..6eaa3f14 100644 --- a/rd-std/src/transparent.rs +++ b/rd-std/src/transparent.rs @@ -1,3 +1,4 @@ +#[cfg(target_os = "linux")] mod origin_addr; #[cfg(target_os = "linux")] mod redir; diff --git a/rd-std/src/transparent/origin_addr.rs b/rd-std/src/transparent/origin_addr.rs index df638054..736ff594 100644 --- a/rd-std/src/transparent/origin_addr.rs +++ b/rd-std/src/transparent/origin_addr.rs @@ -4,10 +4,8 @@ pub trait OriginAddrExt { fn origin_addr(&self) -> io::Result; } -#[cfg(target_os = "linux")] use std::os::unix::prelude::AsRawFd; -#[cfg(target_os = "linux")] impl OriginAddrExt for T { fn origin_addr(&self) -> io::Result { use socket2::SockAddr;