Skip to content

Suppress dead_code warnings for Unix-only auth fields - #633

Merged
logbie merged 2 commits into
mainfrom
claude/nightly-build-failure-cjhdf7
Jul 17, 2026
Merged

Suppress dead_code warnings for Unix-only auth fields#633
logbie merged 2 commits into
mainfrom
claude/nightly-build-failure-cjhdf7

Conversation

@logbie

@logbie logbie commented Jul 17, 2026

Copy link
Copy Markdown
Collaborator

Summary

Adds #[cfg_attr] attributes to suppress compiler warnings for fields and variables in AuthManager that are only used on Unix platforms, improving code clarity and reducing noise in the build output.

Changes

  • Added #[cfg_attr(not(unix), allow(dead_code))] to the manage_parent_permissions field, which is only consulted when tightening directory permissions (a Unix-only concern)
  • Refactored the created_parent variable from a mutable binding to an immutable let binding that captures the result of a match expression
  • Added #[cfg_attr(not(unix), allow(unused_variables))] to the created_parent binding, which is only read on Unix where freshly created credentials directories are locked down to 0o700
  • Updated comments to clarify the platform-specific usage of these fields

Implementation Details

The changes maintain the same runtime behavior while making the platform-specific nature of the code more explicit. The created_parent variable is now assigned directly from the match expression rather than being mutated in separate branches, which is more idiomatic Rust and aligns with the immutable-by-default philosophy.

https://claude.ai/code/session_01RypGs2Z4voxkKN7Y7FgZtR


Open in Devin Review

Summary by CodeRabbit

  • Bug Fixes
    • Improved cross-platform handling when securely storing authentication credentials.
    • Preserved validation that credential directories are real directories and not symlinks.
    • Continued applying appropriate directory permissions on Unix systems.

The nightly Windows build failed at the clippy step because
`AuthManager::manage_parent_permissions` and the local `created_parent`
variable in `store_token` are only ever read inside `#[cfg(unix)]`
blocks. On non-Unix targets that code is compiled out, so clippy's
`-D warnings` promoted the resulting dead-code / unused-variable /
unused-assignment lints to hard errors (3 errors), aborting the build.

The main CI clippy job runs only on ubuntu-latest, where `cfg(unix)` is
true and the code is used, so this was never caught in PR review — only
the nightly runs clippy on windows-latest.

Fix without changing behavior:
- Gate the field's dead-code lint with `#[cfg_attr(not(unix), allow(dead_code))]`.
- Rewrite `created_parent` as a single value-returning `match` (removing
  the `unused_assignments` case entirely) and gate the remaining
  unused-variable lint with `#[cfg_attr(not(unix), allow(unused_variables))]`.

The Unix permission-tightening logic and all existing auth tests are
unchanged. Verified by reproducing the exact 3 errors against the
x86_64-pc-windows-gnu target before the fix and confirming a clean
build after, with no regression on the Unix path.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01RypGs2Z4voxkKN7Y7FgZtR
Copilot AI review requested due to automatic review settings July 17, 2026 06:38
@coderabbitai

coderabbitai Bot commented Jul 17, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 62233b41-a756-45a9-9801-a42956d9a480

📥 Commits

Reviewing files that changed from the base of the PR and between 7701222 and 96ec134.

📒 Files selected for processing (1)
  • crates/wflpkg/src/registry/auth.rs

📝 Walkthrough

Walkthrough

Changes

Auth directory handling

Layer / File(s) Summary
Directory creation and platform warnings
crates/wflpkg/src/registry/auth.rs
Adds non-Unix warning allowances and refactors store_token’s parent-directory creation tracking while preserving symlink, directory, creation, and IO-error handling.

Estimated code review effort: 2 (Simple) | ~10 minutes

Suggested reviewers: copilot

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title accurately reflects the main change: suppressing Unix-only dead_code warnings in auth-related code.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch claude/nightly-build-failure-cjhdf7

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@devin-ai-integration devin-ai-integration Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

✅ Devin Review: No Issues Found

Devin Review analyzed this PR and found no bugs or issues to report.

Open in Devin Review

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

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 reduces non-Unix build noise in wflpkg by explicitly marking Unix-only auth/permissions fields and bindings as intentionally unused on other platforms, without changing runtime behavior.

Changes:

  • Added #[cfg_attr(not(unix), allow(dead_code))] to a Unix-only AuthManager field to avoid “field is never read” warnings on non-Unix targets.
  • Refactored created_parent to an immutable let bound to a match expression and added #[cfg_attr(not(unix), allow(unused_variables))] to suppress non-Unix unused-variable warnings.
  • Clarified comments describing why the field/variable is platform-specific.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

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