Skip to content

Fix: cargo clippy -- -D warnings on macOS#72

Merged
lance0 merged 1 commit intolance0:masterfrom
SSakutaro:fix/macos-clippy-warnings
May 2, 2026
Merged

Fix: cargo clippy -- -D warnings on macOS#72
lance0 merged 1 commit intolance0:masterfrom
SSakutaro:fix/macos-clippy-warnings

Conversation

@SSakutaro
Copy link
Copy Markdown
Contributor

Summary

Fixes cargo clippy -- -D warnings on macOS.

The macOS build reported:

  • unused imports
  • unused variable
  • needless return

Linux-only imports and variables are now guarded with #[cfg(target_os = "linux")], and needless return statements were removed from platform-specific socket creation branches.

Testing

Ran the following checks on Linux and macOS:

  • cargo build
  • cargo test
  • cargo clippy -- -D warnings
  • cargo fmt -- --check

Copilot AI review requested due to automatic review settings May 2, 2026 04:30
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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_dgram local with #[cfg(target_os = "linux")] so macOS builds no longer report them as unused.
  • Remove a few needless return statements 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.

@lance0
Copy link
Copy Markdown
Owner

lance0 commented May 2, 2026

Thanks @SSakutaro — clean fix. The Linux cfg-gating and dropping the redundant returns on cfg-isolated branches is exactly right.

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 build-macos and build-freebsd in a follow-up — bug catches CI bug, nice work. Merging.

@lance0 lance0 merged commit b6d3ae1 into lance0:master May 2, 2026
8 of 9 checks passed
lance0 added a commit that referenced this pull request May 2, 2026
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.
@SSakutaro
Copy link
Copy Markdown
Contributor Author

@lance0
Thanks for the quick review and merge!
Happy to help catch the CI gap. I'll proceed with the Homebrew core PR next.

@lance0
Copy link
Copy Markdown
Owner

lance0 commented May 2, 2026

No problem ! Appreciate you.

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.

3 participants