Skip to content

Commit 8b0b9e8

Browse files
committed
fix(clippy): allow dead_code on find_node_dirs_sync for non-macOS targets
The function is only called from `#[cfg(target_os = "macos")]` blocks in `get_global_node_modules_paths` (Homebrew / nvm / volta / fnm fallbacks) and from inline `#[cfg(test)] mod tests` entries. On Linux/Windows clippy sees no production caller and trips `-D dead_code` under `cargo clippy --workspace --all-features -- -D warnings` (CI's invocation). Gating the function itself to `target_os = "macos"` would break the inline tests on Linux. `#[allow(dead_code)]` is the right tool: keeps the symbol visible on every target while clippy treats it as intentionally unused. Surfaced by CI run 26332596376 on PR #80; local clippy on macOS host passes either way because the macOS callers are live there. Assisted-by: Claude Code:claude-opus-4-7
1 parent 68a9753 commit 8b0b9e8

1 file changed

Lines changed: 7 additions & 0 deletions

File tree

crates/socket-patch-core/src/crawlers/npm_crawler.rs

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -197,6 +197,13 @@ pub fn parse_bun_bin_output(stdout: &str) -> Option<String> {
197197
///
198198
/// Each segment is either a literal directory name or `"*"` which matches any
199199
/// directory entry. Symlinks are followed via `std::fs::metadata`.
200+
///
201+
/// Production callers live inside `#[cfg(target_os = "macos")]` blocks of
202+
/// `get_global_node_modules_paths` (Homebrew/nvm/volta/fnm fallbacks).
203+
/// `#[allow(dead_code)]` keeps the function visible to the inline
204+
/// `#[cfg(test)] mod tests` callers on every target without tripping
205+
/// `-D dead_code` on non-macOS clippy runs.
206+
#[allow(dead_code)]
200207
fn find_node_dirs_sync(base: &Path, segments: &[&str]) -> Vec<PathBuf> {
201208
if !base.is_dir() {
202209
return Vec::new();

0 commit comments

Comments
 (0)