From fdb9bedb031559b17f23ab10c55cd37f87181321 Mon Sep 17 00:00:00 2001 From: Noah <2+noah@noreply.gitea.bluefla.re> Date: Mon, 16 Nov 2026 22:09:04 -0600 Subject: [PATCH] fix(flash): compile the zynq_nand temp-file writer on non-unix targets The Windows-target clippy gate (verify-windows) failed: zynq_nand's write_private was #[cfg(unix)] only, but TempFile::with calls it unconditionally, so on x86_64-pc-windows-gnu it was E0425 (not found), and the module-top `use std::io::Write as _` / `use std::path::Path` then read as unused. aml_ubi already handles this with a #[cfg(not(unix))] std::fs::write fallback; mirror that here, and move the Write import into the unix branch that uses it (as aml_ubi does) so neither import is unused on Windows. Verified: native clippy -D warnings clean, and the CI Windows command `cargo clippy --workspace --exclude alkane-gui --exclude wx-rs --all-targets --target x86_64-pc-windows-gnu -- -D warnings` now passes (exit 0). Co-Authored-By: Claude Opus 4.8 Claude-Session: https://claude.ai/code/session_01B1W6qKwKxq3oUPDKWicM6i --- crates/alkane-flash/src/zynq_nand.rs | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/crates/alkane-flash/src/zynq_nand.rs b/crates/alkane-flash/src/zynq_nand.rs index 726c233c..7abf9f0f 100644 --- a/crates/alkane-flash/src/zynq_nand.rs +++ b/crates/alkane-flash/src/zynq_nand.rs @@ -34,7 +34,6 @@ use crate::md5::md5_hex; use crate::stock::StockError; use crate::transport::{Remote, SshOptions, SshTransport}; use crate::uimage::{self, Kind}; -use std::io::Write as _; use std::path::Path; use std::sync::atomic::{AtomicU64, Ordering}; use std::time::Duration; @@ -131,6 +130,7 @@ impl Drop for TempFile { #[cfg(unix)] fn write_private(path: &Path, contents: &[u8]) -> std::io::Result<()> { + use std::io::Write as _; use std::os::unix::fs::OpenOptionsExt; let mut f = std::fs::OpenOptions::new() .create(true) @@ -142,6 +142,11 @@ fn write_private(path: &Path, contents: &[u8]) -> std::io::Result<()> { f.flush() } +#[cfg(not(unix))] +fn write_private(path: &Path, contents: &[u8]) -> std::io::Result<()> { + std::fs::write(path, contents) +} + impl AlkaneShell { fn connect(host: &str, password: Option<&str>) -> Result { let secret = TempFile::with(password.unwrap_or("alkane").as_bytes(), "pw")?;