Skip to content

Commit

Permalink
chore: clippy fix (#1706)
Browse files Browse the repository at this point in the history
* chore: clippy fix

* clippy fix for bsd
  • Loading branch information
AaronChen0 authored Oct 5, 2024
1 parent f4c7aa1 commit e44cc27
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 34 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -55,16 +55,8 @@ impl UdpRedirSocket {
socket.set_reuse_address(true)?;
if reuse_port {
if let Err(err) = socket.set_reuse_port(true) {
if let Some(errno) = err.raw_os_error() {
match errno {
libc::ENOPROTOOPT => {
trace!("failed to set SO_REUSEPORT, error: {}", err);
}
_ => {
error!("failed to set SO_REUSEPORT, error: {}", err);
return Err(err);
}
}
if let Some(libc::ENOPROTOOPT) = err.raw_os_error() {
trace!("failed to set SO_REUSEPORT, error: {}", err);
} else {
error!("failed to set SO_REUSEPORT, error: {}", err);
return Err(err);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,16 +54,8 @@ impl UdpRedirSocket {
socket.set_reuse_address(true)?;
if reuse_port {
if let Err(err) = socket.set_reuse_port(true) {
if let Some(errno) = err.raw_os_error() {
match errno {
libc::ENOPROTOOPT => {
trace!("failed to set SO_REUSEPORT, error: {}", err);
}
_ => {
error!("failed to set SO_REUSEPORT, error: {}", err);
return Err(err);
}
}
if let Some(libc::ENOPROTOOPT) = err.raw_os_error() {
trace!("failed to set SO_REUSEPORT, error: {}", err);
} else {
error!("failed to set SO_REUSEPORT, error: {}", err);
return Err(err);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -57,16 +57,8 @@ impl UdpRedirSocket {
socket.set_reuse_address(true)?;
if reuse_port {
if let Err(err) = socket.set_reuse_port(true) {
if let Some(errno) = err.raw_os_error() {
match errno {
libc::ENOPROTOOPT => {
trace!("failed to set SO_REUSEPORT, error: {}", err);
}
_ => {
error!("failed to set SO_REUSEPORT, error: {}", err);
return Err(err);
}
}
if let Some(libc::ENOPROTOOPT) = err.raw_os_error() {
trace!("failed to set SO_REUSEPORT, error: {}", err);
} else {
error!("failed to set SO_REUSEPORT, error: {}", err);
return Err(err);
Expand Down
6 changes: 2 additions & 4 deletions crates/shadowsocks/src/relay/udprelay/compat.rs
Original file line number Diff line number Diff line change
Expand Up @@ -181,8 +181,7 @@ pub trait DatagramReceiveExt: DatagramReceive {
}

/// Async method for `poll_recv_ready`
#[allow(clippy::needless_lifetimes)]
fn recv_ready<'a>(&'a self) -> RecvReadyFut<'a, Self> {
fn recv_ready(&self) -> RecvReadyFut<'_, Self> {
RecvReadyFut { io: self }
}
}
Expand All @@ -202,8 +201,7 @@ pub trait DatagramSendExt: DatagramSend {
}

/// Async method for `poll_send_ready`
#[allow(clippy::needless_lifetimes)]
fn send_ready<'a>(&'a self) -> SendReadyFut<'a, Self> {
fn send_ready(&self) -> SendReadyFut<'_, Self> {
SendReadyFut { io: self }
}
}
Expand Down

0 comments on commit e44cc27

Please sign in to comment.