fix(core): listing() 与唯一调用点同 gate #[cfg(windows)],消掉 Linux 上的 dead_code
CI 的 clippy (ubuntu-latest) 退出码 101 的唯一首因: error: function `listing` is never used --> crates/core/tests/adopt/surface_cases.rs:147:4 note: `-D dead-code` implied by `-D warnings` `listing()` 的 4 处调用(43/65/69/73 行)全部落在 `#[cfg(windows)]` 的 `a_junction_on_the_instances_dir_must_not_write_into_the_game_root` 里,helper 本身没 gate ⇒ Linux 上调用点整块编掉,helper 变死代码;Windows 上跑不出来(本地一直绿的原因)。 最小改法:只给 helper 加 `#[cfg(windows)]`,与调用点对齐(同仓既有写法见 tests/launch/watchdog_cases.rs 的 `chatty_lines()`)。不删用例、不改断言、不给整个 mod 加 cfg、不用 #[allow(dead_code)] 静音。 验证:Linux 容器 ull-linux-check:bookworm 上 cargo clippy --workspace --all-targets -- -D warnings;Windows 上 cargo clippy -p unlucky-core --all-targets -- -D warnings 且 adopt 测试清单仍有那条 junction 用例(4 处调用仍在编)。
This commit is contained in:
1 parent
a8ef1c70af
commit
150243e0b6
1 file changed
+5
@@ -144,6 +144,11 @@ fn a_truly_missing_versions_dir_stays_empty() {
|
||||
}
|
||||
|
||||
/// 目录里直接子项的名字(排序后,用于「有没有新增」的判据)。
|
||||
///
|
||||
/// cfg 必须与唯一的调用点(`a_junction_on_the_instances_dir_must_not_write_into_the_game_root`)
|
||||
/// 对齐:那条用例是 `#[cfg(windows)]`(目录联接夹具只在 Windows 上建得出来),Linux 上调用点
|
||||
/// 整块编掉,未 gate 的 helper 就成了 `dead_code`(CI 的 `-D warnings` 会让 clippy 退出 101)。
|
||||
#[cfg(windows)]
|
||||
fn listing(dir: &std::path::Path) -> Vec<String> {
|
||||
let mut names: Vec<String> = std::fs::read_dir(dir)
|
||||
.expect("读目录")
|
||||
|
||||
Reference in new issue
Block a user