Suppress dead_code warnings for Unix-only auth fields - #633
Conversation
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
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (1)
📝 WalkthroughWalkthroughChangesAuth directory handling
Estimated code review effort: 2 (Simple) | ~10 minutes Suggested reviewers: 🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
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. Comment |
There was a problem hiding this comment.
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-onlyAuthManagerfield to avoid “field is never read” warnings on non-Unix targets. - Refactored
created_parentto an immutableletbound to amatchexpression 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.
Summary
Adds
#[cfg_attr]attributes to suppress compiler warnings for fields and variables inAuthManagerthat are only used on Unix platforms, improving code clarity and reducing noise in the build output.Changes
#[cfg_attr(not(unix), allow(dead_code))]to themanage_parent_permissionsfield, which is only consulted when tightening directory permissions (a Unix-only concern)created_parentvariable from a mutable binding to an immutableletbinding that captures the result of amatchexpression#[cfg_attr(not(unix), allow(unused_variables))]to thecreated_parentbinding, which is only read on Unix where freshly created credentials directories are locked down to0o700Implementation Details
The changes maintain the same runtime behavior while making the platform-specific nature of the code more explicit. The
created_parentvariable 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
Summary by CodeRabbit