From 12a11edfd7d999bf387522e3bd7abfe39745e696 Mon Sep 17 00:00:00 2001 From: Noah <2+noah@noreply.gitea.bluefla.re> Date: Mon, 16 Nov 2026 22:46:43 -0600 Subject: [PATCH] style: rustfmt the A113D GUI install + headless bench driver cargo fmt -p alkane-gui; no logic change. This branch's CI never ran before (its verify was skipped), so the formatting was never enforced. Co-Authored-By: Claude Opus 4.8 Claude-Session: https://claude.ai/code/session_01B1W6qKwKxq3oUPDKWicM6i --- crates/alkane-gui/src/bench_sequence.rs | 31 ++++++++++++++++++------- crates/alkane-gui/src/main.rs | 2 +- crates/alkane-gui/src/stock_ops.rs | 5 +++- 3 files changed, 27 insertions(+), 11 deletions(-) diff --git a/crates/alkane-gui/src/bench_sequence.rs b/crates/alkane-gui/src/bench_sequence.rs index d345ac9d..d251d8e9 100644 --- a/crates/alkane-gui/src/bench_sequence.rs +++ b/crates/alkane-gui/src/bench_sequence.rs @@ -53,9 +53,7 @@ fn drive(label: &str, handle: StockHandle) -> bool { fn ssh_banner(host: &str) -> Option { let addr: std::net::SocketAddr = format!("{host}:22").parse().ok()?; let mut stream = TcpStream::connect_timeout(&addr, Duration::from_secs(5)).ok()?; - stream - .set_read_timeout(Some(Duration::from_secs(5))) - .ok()?; + stream.set_read_timeout(Some(Duration::from_secs(5))).ok()?; let mut buf = [0u8; 256]; let n = stream.read(&mut buf).ok()?; if n == 0 { @@ -129,7 +127,10 @@ fn mac_of(host: &str) -> Option { let _ = Command::new("ping") .args(["-c", "1", "-W", "1", host]) .output(); - let out = Command::new("ip").args(["neigh", "show", host]).output().ok()?; + let out = Command::new("ip") + .args(["neigh", "show", host]) + .output() + .ok()?; let s = String::from_utf8_lossy(&out.stdout); let mut it = s.split_whitespace(); while let Some(t) = it.next() { @@ -183,7 +184,12 @@ fn ip_for_mac(mac: &str) -> Option { /// Poll until the board (located by MAC, so a changed DHCP lease is followed) /// reaches the wanted stock-ness, or `timeout` elapses. Returns the board's /// current IP, a description, and whether the target state was reached. -fn wait_for(mac: Option<&str>, fallback: &str, want_stock: bool, timeout: Duration) -> (String, String, bool) { +fn wait_for( + mac: Option<&str>, + fallback: &str, + want_stock: bool, + timeout: Duration, +) -> (String, String, bool) { let deadline = Instant::now() + timeout; let mut ip = fallback.to_string(); let mut swept = Instant::now() - Duration::from_secs(60); @@ -255,7 +261,8 @@ pub fn run(spec: &str) -> i32 { let mac = mac_of(&host); println!( "board MAC: {}", - mac.as_deref().unwrap_or("unknown (will use the fixed host)") + mac.as_deref() + .unwrap_or("unknown (will use the fixed host)") ); let boot_timeout = Duration::from_secs(300); @@ -270,7 +277,7 @@ pub fn run(spec: &str) -> i32 { vec![host.clone()], board.clone(), AfwSource::Local(afw.clone()), - true, // allow unsigned (bench image) + true, // allow unsigned (bench image) stock_password.clone(), false, // not an in-place update ); @@ -286,7 +293,10 @@ pub fn run(spec: &str) -> i32 { boot_timeout.as_secs() ); let (alkane_ip, desc, ok) = wait_for(mac.as_deref(), &host, false, boot_timeout); - println!(" {desc} => {}", if ok { "ALKANE" } else { "NOT ALKANE (fail)" }); + println!( + " {desc} => {}", + if ok { "ALKANE" } else { "NOT ALKANE (fail)" } + ); all_ok = all_ok && ok; // 3. restore (alkane -> stock) flag-flip at the board's CURRENT address @@ -303,7 +313,10 @@ pub fn run(spec: &str) -> i32 { boot_timeout.as_secs() ); let (_stock_ip, desc, ok) = wait_for(mac.as_deref(), &host, true, boot_timeout); - println!(" {desc} => {}", if ok { "STOCK" } else { "NOT STOCK (fail)" }); + println!( + " {desc} => {}", + if ok { "STOCK" } else { "NOT STOCK (fail)" } + ); all_ok = all_ok && ok; } diff --git a/crates/alkane-gui/src/main.rs b/crates/alkane-gui/src/main.rs index bbced90d..092ffcf1 100644 --- a/crates/alkane-gui/src/main.rs +++ b/crates/alkane-gui/src/main.rs @@ -138,7 +138,7 @@ fn headless_mode() -> bool { "ALKANE_BENCH_SEQUENCE", ] .iter() - .any(|v| std::env::var_os(v).is_some()) + .any(|v| std::env::var_os(v).is_some()) } /// A Windows GUI-subsystem process has no console, so output from the headless diff --git a/crates/alkane-gui/src/stock_ops.rs b/crates/alkane-gui/src/stock_ops.rs index 1cb88121..b09b685a 100644 --- a/crates/alkane-gui/src/stock_ops.rs +++ b/crates/alkane-gui/src/stock_ops.rs @@ -26,7 +26,10 @@ use crate::scan::fake_scan_enabled; /// `SUPPORTED`). Only these are offered as install targets. pub const SUPPORTED_BOARDS: &[(&str, &str)] = &[ ("zynq-7010", "Antminer S17 (Xilinx Zynq-7010 control board)"), - ("a113d", "Antminer S19j Pro (Amlogic A113D/AXG control board)"), + ( + "a113d", + "Antminer S19j Pro (Amlogic A113D/AXG control board)", + ), ]; /// The default install board when the user has not chosen another.