GCWing / GCWing/OpenBitFun

[Bug]: dead_code/unused_imports warnings for unix-only CLI dispatch and daemon symbols on Windows builds

オープン 初心者向け
#2,579 コメント 0 件 リアクション 0 件 担当者 0 名 GitHub で見る
主要言語
Rust
スター
2.2k
フォーク
229
平均マージ
2時間 46分
マージ済み PR(30日)
577

説明

Three Windows `cargo check` warnings in the CLI crate point at symbols whose only production consumers are already unix-only, while the symbols themselves are compiled unconditionally.

**Symptom**

- `src/apps/cli/src/dispatch/runner.rs:2` — `unused_imports`: `std::time::Duration` is consumed only inside `#[cfg(unix)]` code paths (the unix process-group wait in `wait_for_process_group_exit` and a unix-only test case), so on Windows the import dangles.
- `src/apps/cli/src/dispatch/runner.rs:337` — `dead_code`: `arguments_match_action` is called from the `target_os = "linux"` and `target_os = "macos"` service paths (both of which imply unix) and from the platform-agnostic unit tests, but never on Windows.
- `src/apps/cli/src/daemon/service.rs:88` — `dead_code`: `run_command` is only called from the macOS launchd and the systemd service management paths, all of which are unix-only.

**Root cause**

The definitions are unconditional while every consumer is gated behind unix cfgs, so Windows builds carry symbols with no reachable caller.

**Proposed fix**

Mirror the real consumer surfaces with precise cfg gates: `#[cfg(unix)]` on the import and on `run_command`, and `#[cfg(any(unix, test))]` on `arguments_match_action` so the platform-agnostic unit tests keep compiling on every platform. No behavior changes, no test removals, no assertions weakened; Linux and macOS builds keep every symbol exactly as before.

**Verification**

- `cargo check --locked -p bitfun-cli` on Windows: 0 errors, and the three warnings no longer appear.
- `cargo test --locked -p bitfun-cli dispatch::runner`: 7 passed, 0 failed (the cfg(any(unix, test)) gate keeps the runner tests compiling on Windows).
- The unix-side compilation surface is confirmed by the repository CI platform matrix (ubuntu/macos jobs).

コントリビューションガイド

コントリビューションガイドを開く

調査の方向性

Start with src/apps/cli/src/dispatch/runner.rs and src/apps/cli/src/daemon/service.rs, focusing on the symbols and lines identified in the issue. Compare each definition with its unix-only consumers and preserve the platform-agnostic runner tests. Verify with cargo check --locked -p bitfun-cli on Windows and cargo test --locked -p bitfun-cli dispatch::runner, with no warnings from the three reported symbols.

索引モデルが issue の本文から書いたものです。

評価

技術スタック
rust
領域
cli
issue の種類
バグ
難易度
2/5
見積もり時間
1〜3時間
活発さ
活発
明瞭さ
明確に書かれている
初心者へのやさしさ
88/100

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。