fixed clippy warnings

This commit is contained in:
zonyitoo
2021-05-16 01:27:14 +08:00
parent a3b74ee9d6
commit 39c484f264
3 changed files with 10 additions and 10 deletions
+8 -8
View File
@@ -305,7 +305,7 @@ cfg_if! {
/// Available TCP transparent proxy types
#[doc(hidden)]
pub fn tcp_available_types() -> &'static [&'static str] {
const AVAILABLE_TYPES: &'static [&'static str] = &[RedirType::Redirect.name(), RedirType::TProxy.name()];
const AVAILABLE_TYPES: &[&str] = &[RedirType::Redirect.name(), RedirType::TProxy.name()];
AVAILABLE_TYPES
}
@@ -317,7 +317,7 @@ cfg_if! {
/// Available UDP transparent proxy types
#[doc(hidden)]
pub fn udp_available_types() -> &'static [&'static str] {
const AVAILABLE_TYPES: &'static [&'static str] = &[RedirType::TProxy.name()];
const AVAILABLE_TYPES: &[&str] = &[RedirType::TProxy.name()];
AVAILABLE_TYPES
}
} else if #[cfg(any(target_os = "openbsd", target_os = "freebsd"))] {
@@ -329,7 +329,7 @@ cfg_if! {
/// Available TCP transparent proxy types
#[doc(hidden)]
pub fn tcp_available_types() -> &'static [&'static str] {
const AVAILABLE_TYPES: &'static [&'static str] = &[RedirType::PacketFilter.name(), RedirType::IpFirewall.name()];
const AVAILABLE_TYPES: &[&str] = &[RedirType::PacketFilter.name(), RedirType::IpFirewall.name()];
AVAILABLE_TYPES
}
@@ -341,7 +341,7 @@ cfg_if! {
/// Available UDP transparent proxy types
#[doc(hidden)]
pub const fn udp_available_types() -> &'static [&'static str] {
const AVAILABLE_TYPES: &'static [&'static str] = &[RedirType::PacketFilter.name(), RedirType::IpFirewall.name()];
const AVAILABLE_TYPES: &[&str] = &[RedirType::PacketFilter.name(), RedirType::IpFirewall.name()];
AVAILABLE_TYPES
}
} else if #[cfg(any(target_os = "netbsd", target_os = "solaris", target_os = "macos", target_os = "ios"))] {
@@ -353,7 +353,7 @@ cfg_if! {
/// Available TCP transparent proxy types
#[doc(hidden)]
pub const fn tcp_available_types() -> &'static [&'static str] {
const AVAILABLE_TYPES: &'static [&'static str] = &[RedirType::PacketFilter.name(), RedirType::IpFirewall.name()];
const AVAILABLE_TYPES: &[&str] = &[RedirType::PacketFilter.name(), RedirType::IpFirewall.name()];
AVAILABLE_TYPES
}
@@ -365,7 +365,7 @@ cfg_if! {
/// Available UDP transparent proxy types
#[doc(hidden)]
pub const fn udp_available_types() -> &'static [&'static str] {
const AVAILABLE_TYPES: &'static [&'static str] = &[];
const AVAILABLE_TYPES: &[&str] = &[];
AVAILABLE_TYPES
}
} else {
@@ -377,7 +377,7 @@ cfg_if! {
/// Available TCP transparent proxy types
#[doc(hidden)]
pub const fn tcp_available_types() -> &'static [&'static str] {
const AVAILABLE_TYPES: &'static [&'static str] = &[];
const AVAILABLE_TYPES: &[&str] = &[];
AVAILABLE_TYPES
}
@@ -389,7 +389,7 @@ cfg_if! {
/// Available UDP transparent proxy types
#[doc(hidden)]
pub const fn udp_available_types() -> &'static [&'static str] {
const AVAILABLE_TYPES: &'static [&'static str] = &[];
const AVAILABLE_TYPES: &[&str] = &[];
AVAILABLE_TYPES
}
}
@@ -187,7 +187,7 @@ impl Socks {
version => {
error!("unsupported socks version {:x}", version);
let err = io::Error::new(ErrorKind::Other, "unsupported socks version");
return Err(err);
Err(err)
}
}
}
@@ -189,7 +189,7 @@ async fn decrypt_payload_stream(
trace!("UDP packet got stream IV {:?}", ByteStr::new(iv));
let mut cipher = Cipher::new(method, key, iv);
assert_eq!(cipher.decrypt_packet(data), true);
assert!(cipher.decrypt_packet(data));
let (dn, addr) = parse_packet(data).await?;