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 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01B1W6qKwKxq3oUPDKWicM6i
This commit is contained in:
@@ -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<Self, StockError> {
|
||||
let secret = TempFile::with(password.unwrap_or("alkane").as_bytes(), "pw")?;
|
||||
|
||||
Reference in New Issue
Block a user