chore(clippy): clean up accumulated Windows-only clippy warnings#10149
chore(clippy): clean up accumulated Windows-only clippy warnings#10149JamBalaya56562 wants to merge 1 commit into
Conversation
There was a problem hiding this comment.
Code Review
This pull request introduces conditional compilation attributes and import adjustments to resolve compiler warnings and improve cross-platform compatibility, particularly for Windows. The feedback suggests broadening the #[cfg_attr(windows, allow(dead_code))] attributes in src/env.rs to target all non-Linux platforms, as the affected code is unused on systems like macOS as well.
Greptile SummaryThis PR suppresses accumulated Windows-only
Confidence Score: 5/5Pure lint suppression with no logic changes; safe to merge. Every change is either adding a cfg gate to an import that was already platform-specific or annotating an item with allow(dead_code) under a cfg_attr. No executable paths are altered, and the PR author confirms clippy is clean and all 943 tests pass on Windows after these changes. No files require special attention. Important Files Changed
Reviews (3): Last reviewed commit: "chore(clippy): clean up accumulated Wind..." | Re-trigger Greptile |
c4e175f to
e40f44b
Compare
These warnings fire only on the Windows build, where Unix-only code paths
(sandbox enforcement, precompiled-Ruby install, glibc detection) and
cfg(unix)/cfg(not(windows)) imports are inactive. They are unrelated to
feature work and were burying genuinely new warnings.
Most "unused" imports are in fact used under #[cfg(unix)] /
#[cfg(not(windows))]; deleting them would break those builds, so they are
guarded instead (matching the existing cfg(unix) PermissionsExt pattern):
- gem: crate::env
- pipx: crate::env, crate::file, std::path::PathBuf
- task_executor: file::is_executable
- task_confirm / task tests: Config, Task, TaskConfirm, take_captured_fields
Dead-code items are used on Linux/macOS but unreachable on Windows; their
callers are unconditional so the definitions cannot be cfg-gated. Add
#[cfg_attr(windows, allow(dead_code))], mirroring the existing
#[cfg_attr(not(windows), allow(dead_code))] usage in path.rs:
- env: LINUX_GLIBC_VERSION + linux_glibc_version stub
- github: get_release_with_build_revision, pick_best_build_revision
- ruby_common: resolve_rubyinstaller_lock_info
- sandbox: effective_deny_{read,write,net}, apply, SandboxedCommand
Also collapse a nested if (clippy::collapsible_if) in tool_version.rs.
No behavior change. cargo clippy --all-targets is now warning-free and
cargo test --bin mise passes (943 tests) on Windows.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Head branch was pushed to by a user without write access
e40f44b to
78d5b02
Compare
What
Cleans up the pre-existing
cargo clippy --all-targetswarnings that fire only on the Windows build (x86_64-pc-windows-msvc). They are unrelated to feature work and were burying genuinely new warnings under noise.After this change,
cargo clippy --all-targetsis warning-free on Windows andcargo test --bin misestill passes (943 tests). No behavior change.Why these aren't simple deletions
Most of the "unused" symbols are actually used on Linux/macOS (or under
#[cfg(unix)]tests) and are only dead on Windows, where the relevant code paths are#[cfg]-compiled out. Deleting them would break the Unix builds, so:Imports only used under
#[cfg(unix)]/#[cfg(not(windows))]are guarded with the matching#[cfg(...)](same style as the existing#[cfg(unix)] use ...PermissionsExt), not removed:gem:crate::envpipx:crate::env,crate::file,std::path::PathBuftask_executor:file::is_executabletask_confirm/tasktests:Config,Task,TaskConfirm,take_captured_fieldsDead-code items whose callers are unconditional (so the definitions can't be
#[cfg]-gated without a compile error) get#[cfg_attr(windows, allow(dead_code))], mirroring the existing#[cfg_attr(not(windows), allow(dead_code))]insrc/path.rs:env:LINUX_GLIBC_VERSION+ the non-Linuxlinux_glibc_versionstubgithub:get_release_with_build_revision,pick_best_build_revisionruby_common:resolve_rubyinstaller_lock_infosandbox:effective_deny_{read,write,net},apply,SandboxedCommandCollapsed a nested
if(clippy::collapsible_if) intool_version.rs(inside the existing#[cfg(windows)]block).Verification (Windows,
x86_64-pc-windows-msvc)cargo clippy --all-targets→ 0 warningscargo test --bin mise→ 943 passed; 0 failed🤖 Generated with Claude Code