Skip to content

fix(pty): scope the io::Write import to the unix branch#224

Merged
guillaumejay merged 1 commit into
mainfrom
fix/pty-windows-unused-import
Jul 16, 2026
Merged

fix(pty): scope the io::Write import to the unix branch#224
guillaumejay merged 1 commit into
mainfrom
fix/pty-windows-unused-import

Conversation

@guillaumejay

Copy link
Copy Markdown
Collaborator

Problem

cross-os (windows-latest) has been red on main since #217 — two merges ago:

error: unused import: `std::io::Write`
  --> crates/pty/src/status.rs:7:5

write_private needs Write only in its #[cfg(unix)] arm, where it calls file.write_all. The #[cfg(not(unix))] arm goes through fs::write and needs nothing. So the module-scope import is unused on Windows, and clippy -D warnings rejects 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 the OpenOptionsExt import that is already scoped that way.

Why it slipped through

The PR gate runs clippy on ubuntu-latest only. 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-os visible. Out of scope here.

Verification

On Windows, cargo fmt --all --check, cargo clippy --workspace --all-targets -- -D warnings and cargo test --workspace (566 passed) are all green with this change — and clippy fails without it.

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.
@guillaumejay
guillaumejay merged commit c5de0de into main Jul 16, 2026
17 checks passed
@guillaumejay
guillaumejay deleted the fix/pty-windows-unused-import branch July 16, 2026 19:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant