Repository navigation
test: cfg-gate unix-only helpers in issue1794 test (Refs #3772) - #3775
Merged
Merged
Conversation
Root cause: all four test fns and `expected_candidates` in tests/issue1794_user_group_completion.rs are #[cfg(unix)], so on a Windows target the top-level `use std::path::PathBuf`, `use std::process::Command` and `fn rubash` lose all uses and `RUSTFLAGS="-D warnings"` turns the unused-import / dead-code lints into hard errors. (Command becomes unused once `rubash` itself is gated: it is only referenced from that helper.) Fix: add #[cfg(unix)] to both imports and the `rubash` helper, so the file is warning-free on all targets. No behaviour change on any target; on unix the attributes are no-ops. 本 PR 删除了什么: 无(仅为 3 项加 #[cfg(unix)] 属性;无代码、无测试删除)。 UNVERIFIED-BY-CAPTAIN
caomengxuan666
marked this pull request as ready for review
November 16, 2026 10:33
This was referenced Nov 16, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
根因
tests/issue1794_user_group_completion.rs的四个 test fn 与 helperexpected_candidates皆#[cfg(unix)],Windows 靶上整文件被 cfg 掉后,顶层use std::path::PathBuf、use std::process::Command与fn rubash失去全部引用,RUSTFLAGS="-D warnings"下变硬错(unused import + dead code)。Command之所以也要 gate:它只被rubash引用,rubash一 gate 它就成了下一个 unused import。修复
为两处 import 与
rubashhelper 加#[cfg(unix)](共 3 行)。unix 靶上属性为 no-op,无行为变化。验证
RUSTFLAGS="-D warnings" cargo check --locked --test issue1794_user_group_completion退出 101,恰为 issue 所述两错。rustfmt --check干净。详见车道 REPORT(工作区根,未入仓)。本 PR 删除了什么
无。仅为 3 项加
#[cfg(unix)]属性;无代码、无测试删除。UNVERIFIED-BY-CAPTAIN