fix(pty): scope the io::Write import to the unix branch#224
Merged
Conversation
write_private only needs Write in its #[cfg(unix)] arm, where it calls file.write_all; the non-unix arm goes through fs::write. A module-scope import is therefore unused on Windows, which fails clippy -D warnings and has kept cross-os (windows-latest) red on main since #217. The PR gate runs clippy on ubuntu only — cross-os is a post-merge signal by design (docs/CI.md §3), so a platform-conditional import slips through it.
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.
Problem
cross-os (windows-latest)has been red on main since #217 — two merges ago:write_privateneedsWriteonly in its#[cfg(unix)]arm, where it callsfile.write_all. The#[cfg(not(unix))]arm goes throughfs::writeand needs nothing. So the module-scope import is unused on Windows, andclippy -D warningsrejects it.Practical effect beyond the red badge: no Windows dev can run the project's own clippy gate, on any branch. It fails before reaching their code.
Fix
Move the import into the
#[cfg(unix)]function body, next to theOpenOptionsExtimport that is already scoped that way.Why it slipped through
The PR gate runs
clippyonubuntu-latestonly.cross-os(macOS + Windows) is deliberately excluded from PRs and runs on push→main as a post-merge signal, explicitly "not a hard gate" (ci.yml:135-141, docs/CI.md §3). That trade-off is defensible for speed, but it means a platform-conditional mistake is only caught after it lands — and then only if someone reads a non-blocking badge. Two merges passed before this surfaced, and it surfaced because a Windows dev hit it locally, not from CI.Worth a follow-up discussion: nothing currently makes a red
cross-osvisible. Out of scope here.Verification
On Windows,
cargo fmt --all --check,cargo clippy --workspace --all-targets -- -D warningsandcargo test --workspace(566 passed) are all green with this change — and clippy fails without it.