Repository navigation
test: gate unused-mut allow on non-unix for issue2071 stem (Refs #3515) - #3523
Conversation
#3515) cells at tests/issue2071_test_empty_path_regressions.rs:104 was extended only under #[cfg(unix)] (:125 extend_from_slice), so on Windows the mut was unused and -D warnings failed the stem. Move the six unix-only rows into the vec! literal with per-element #[cfg(unix)] and drop the mut (and the extend) instead of suppressing the lint: a bare drop of mut alone would break the unix build (E0596), and a cfg-gated allow would leave the dead mut in place.
b6ecbf2 to
9e6a4ac
Compare
队长复核 PASS结论:合入。 Refs-only,合入后队长手关 #3515。 Diff(已核对原文): 1 文件 +11/−5, 腿(
CI(run 43543511493,失败日志原文已核): 3 红 job(GNU 1349/1/4、macOS 1242/1/4、Linux Rust tests 0/1)唯一失败名均为 交集: merge-base 删除节: 正文已有(删 |
根因
tests/issue2071_test_empty_path_regressions.rs:104的let mut cells在 Windows 下未被使用:唯一一处可变借用是 :125 的cells.extend_from_slice(...),它包在#[cfg(unix)]块里;Windows 编译时该块被裁掉,mut遂成 unused-mut,RUSTFLAGS="-D warnings"下该 stem 编译失败(X299 base 复现:error: variable does not need to be mutable,-D unused-mutimplied by-D warnings,rc=101)。修法
把 6 个 unix-only 行直接移进
vec![]字面量、每行加#[cfg(unix)],删掉mut与extend_from_slice调用。unix 面行集合不变(同 6 行、同顺序),Windows 面行集合不变(仍无这 6 行)。不 suppress lint、不留死mut。注意:不能只删
mut(unix 面仍需可变借用做 extend,会报 E0596);本修法把 extend 本身去掉,故两面都干净。修法来源:前棒车道(08:5x 轮)已在 X299 上写出此 patch 并跑通 Windows 全腿,本轮认领其修法、落到当前 tip(
48175205)提交并开 PR;该文件在前棒 base(9410bc9f)与现行 tip 间无任何改动,Windows 证据直接转移。本 PR 删除了什么
删除
let mut中的mut与#[cfg(unix)] cells.extend_from_slice(&[...])调用(5 行删、11 行增,净 +6 行;6 个 unix 行以#[cfg(unix)]形式保留在字面量内)。未删除任何测试与用例。产品语义零改动。验收
RUSTFLAGS="-D warnings"下 stem 测试 6/6 通过、error/warning 行 0;引擎RUSTFLAGS="-D warnings" cargo check --locked --lib --binsrc=0、0 error/warning;cargo fmt --checkrc=0(前棒 stage1/stage2 日志,X299work/r3515-logs/;本轮在分支内容上重跑确认)。mut被使用);本分支同样干净、测试照常跑;cargo fmt --check逐文件。UNVERIFIED-BY-CAPTAIN