Skip to content

fix: resolve compilation warnings with latest stable toolchain#488

Open
webees wants to merge 1 commit intoeycorsican:masterfrom
webees:fix/compile-warnings
Open

fix: resolve compilation warnings with latest stable toolchain#488
webees wants to merge 1 commit intoeycorsican:masterfrom
webees:fix/compile-warnings

Conversation

@webees
Copy link

@webees webees commented Feb 11, 2026

Summary

This PR fixes 2 compilation warnings that appear when building with the latest stable Rust toolchain and resolving the latest compatible dependencies (no Cargo.lock is committed in this repo).

Changes

1. Replace deprecated TcpStream::set_linger() (leaf/src/proxy/mod.rs)

- stream.set_linger(Some(Duration::ZERO))?;
+ SockRef::from(&stream).set_linger(Some(Duration::ZERO))?;

Why: Tokio deprecated TcpStream::set_linger() starting from v1.37 because SO_LINGER causes the socket to block the calling thread on drop(). Since the project specifies tokio = { version = "1", ... } without a lockfile, any fresh build today resolves tokio ≥ 1.37 and triggers this warning. The replacement uses socket2::SockRef, which is already a dependency of this project. The runtime behavior is identical.

Reference: tokio-rs/tokio#5765

2. Prefix unused parameter gw with underscore (leaf/src/common/cmd_linux.rs)

- gw: Ipv4Addr,
+ _gw: Ipv4Addr,

Why: The add_interface_ipv4_address() function on Linux uses ip addr add, which does not accept a gateway argument (gateways are set separately via ip route add). The gw parameter exists for API parity with the macOS implementation but is correctly unused on Linux. Prefixing with _ makes this intent explicit and silences the unused_variables warning. This warning has existed since the function was first written but may have been overlooked.

Impact

  • Zero behavioral change — both fixes only affect compilation, not runtime logic
  • No API breaking changes — function signatures remain identical
  • Enables warning-free builds for anyone building the project today

- Replace deprecated `TcpStream::set_linger()` with `SockRef::from().set_linger()`
  (tokio deprecated the method as SO_LINGER can block the thread on drop)
- Prefix unused parameter `gw` with underscore in `add_interface_ipv4_address()`
  (the gateway param is unused on Linux as `ip addr add` does not accept it)
@webees webees changed the title fix: resolve compilation warnings on Rust 1.93+ fix: resolve compilation warnings with latest stable toolchain Feb 11, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant