Fix: cargo clippy -- -D warnings on macOS#72
Conversation
There was a problem hiding this comment.
Pull request overview
This PR cleans up platform-specific ICMP probing code so the project passes cargo clippy -- -D warnings on macOS without changing the intended runtime behavior. The changes fit the existing cross-platform socket/probing code by narrowing Linux-only imports/variables and simplifying a few platform-gated return paths.
Changes:
- Guard Linux-only probe-engine imports and the
is_dgramlocal with#[cfg(target_os = "linux")]so macOS builds no longer report them as unused. - Remove a few needless
returnstatements in OS-specific socket construction branches flagged by Clippy. - Keep the platform-specific send/receive socket behavior unchanged while making the code compile cleanly across supported Unix targets.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
src/trace/engine.rs |
Narrows Linux-only imports and locals in ICMP probe execution to match actual platform usage. |
src/probe/socket.rs |
Simplifies several cfg-gated socket factory branches by returning expressions directly instead of using explicit return. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
|
Thanks @SSakutaro — clean fix. The Linux cfg-gating and dropping the redundant You also caught a CI gap on our end: clippy only runs on Linux, so macOS-only warnings are invisible in our own PRs. Adding clippy to |
Linux clippy compiles only the Linux cfg branches, so warnings inside #[cfg(target_os = "macos")] and #[cfg(any(target_os = "freebsd", target_os = "netbsd"))] are invisible. Run clippy on all three platforms to catch platform-specific regressions in our own PRs. Follow-up to #72.
|
@lance0 |
|
No problem ! Appreciate you. |
Summary
Fixes
cargo clippy -- -D warningson macOS.The macOS build reported:
Linux-only imports and variables are now guarded with
#[cfg(target_os = "linux")], and needlessreturnstatements were removed from platform-specific socket creation branches.Testing
Ran the following checks on Linux and macOS:
cargo buildcargo testcargo clippy -- -D warningscargo fmt -- --check