fix: resolve compilation warnings with latest stable toolchain#488
Open
webees wants to merge 1 commit intoeycorsican:masterfrom
Open
fix: resolve compilation warnings with latest stable toolchain#488webees wants to merge 1 commit intoeycorsican:masterfrom
webees wants to merge 1 commit intoeycorsican:masterfrom
Conversation
- 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)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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.lockis committed in this repo).Changes
1. Replace deprecated
TcpStream::set_linger()(leaf/src/proxy/mod.rs)Why: Tokio deprecated
TcpStream::set_linger()starting from v1.37 becauseSO_LINGERcauses the socket to block the calling thread ondrop(). Since the project specifiestokio = { version = "1", ... }without a lockfile, any fresh build today resolves tokio ≥ 1.37 and triggers this warning. The replacement usessocket2::SockRef, which is already a dependency of this project. The runtime behavior is identical.Reference: tokio-rs/tokio#5765
2. Prefix unused parameter
gwwith underscore (leaf/src/common/cmd_linux.rs)Why: The
add_interface_ipv4_address()function on Linux usesip addr add, which does not accept a gateway argument (gateways are set separately viaip route add). Thegwparameter exists for API parity with the macOS implementation but is correctly unused on Linux. Prefixing with_makes this intent explicit and silences theunused_variableswarning. This warning has existed since the function was first written but may have been overlooked.Impact