Skip to content

Commit

Permalink
style: make clippy happy
Browse files Browse the repository at this point in the history
  • Loading branch information
iHsin committed Apr 9, 2024
1 parent a55436d commit 03d3926
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 10 deletions.
1 change: 0 additions & 1 deletion clash_lib/src/proxy/http/inbound/connector.rs
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,6 @@ impl tower::Service<Uri> for Connector {
typ: Type::Http,
source: src,
destination: destination.ok_or(ProxyError::InvalidUrl(url.to_string()))?,
..Default::default()
};

tokio::spawn(async move {
Expand Down
2 changes: 0 additions & 2 deletions clash_lib/src/proxy/http/inbound/proxy.rs
Original file line number Diff line number Diff line change
Expand Up @@ -65,8 +65,6 @@ async fn proxy(
typ: Type::HttpConnect,
source: src,
destination: addr,

..Default::default()
};

dispatcher.dispatch_stream(sess, upgraded).await
Expand Down
1 change: 0 additions & 1 deletion clash_lib/src/proxy/tun/inbound.rs
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@ async fn handle_inbound_stream(
typ: Type::Tun,
source: local_addr,
destination: remote_addr.into(),
..Default::default()
};

dispatcher.dispatch_stream(sess, stream).await;
Expand Down
12 changes: 6 additions & 6 deletions clash_lib/src/proxy/utils/socket_helpers.rs
Original file line number Diff line number Diff line change
Expand Up @@ -100,12 +100,12 @@ pub async fn new_tcp_stream<'a>(
};

let global_iface = get_iface();
if let Some(iface) = iface.or_else(|| global_iface.as_ref()) {
must_bind_socket_on_interface(&socket, &iface)?;
if let Some(iface) = iface.or(global_iface.as_ref()) {
must_bind_socket_on_interface(&socket, iface)?;
}

#[cfg(target_os = "linux")]
if let Some(packet_mark) = packet_mark.or_else(|| get_somark()) {
if let Some(packet_mark) = packet_mark.or_else(get_somark) {
socket.set_mark(packet_mark)?;
}

Expand Down Expand Up @@ -143,12 +143,12 @@ pub async fn new_udp_socket(
}

let global_iface = get_iface();
if let Some(iface) = iface.or_else(|| global_iface.as_ref()) {
must_bind_socket_on_interface(&socket, &iface)?;
if let Some(iface) = iface.or(global_iface.as_ref()) {
must_bind_socket_on_interface(&socket, iface)?;
}

#[cfg(target_os = "linux")]
if let Some(packet_mark) = packet_mark.or_else(|| get_somark()) {
if let Some(packet_mark) = packet_mark.or_else(get_somark) {
socket.set_mark(packet_mark)?;
}

Expand Down

0 comments on commit 03d3926

Please sign in to comment.