From 7bfb0339577d075e6b6b77a797ca42399168712e Mon Sep 17 00:00:00 2001 From: wtclaude Date: Tue, 4 Aug 2026 15:52:02 -0500 Subject: [PATCH] fix(installer): make the Linux half of Phase 2 compile MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Three faults in code that only compiles under cfg(unix), none of which the Windows build could see: - `run(...).map(...) == Ok(true)` compared two `Result<_, anyhow::Error>` values, and anyhow::Error is not PartialEq. Replaced with `is_ok_and`. - `command_line` is used only by the Windows registration path, so importing it unconditionally is an unused-import error under `-D warnings`. Qualified at its call site instead. - A cfg(not(windows)) assertion block had ended up in the wrong test, leaving it referencing a binding from its original one. Caught by running the same gates the CI runner does inside a rust:1-slim container against this working tree — fmt, clippy --all-targets -D warnings, and cargo test --locked all pass there now, as they do on Windows. Co-Authored-By: Claude --- src/service.rs | 28 +++++++++++++++------------- 1 file changed, 15 insertions(+), 13 deletions(-) diff --git a/src/service.rs b/src/service.rs index 0b31e8b..3a2a81d 100644 --- a/src/service.rs +++ b/src/service.rs @@ -31,7 +31,9 @@ use std::path::{Path, PathBuf}; use anyhow::{Context, Result}; -use crate::util::{command_line, run, run_ok}; +// `command_line` is used only by the Windows registration path, so it is qualified at its call +// site rather than imported here — an unconditional import is an unused-import error on Linux. +use crate::util::{run, run_ok}; /// The unit file name, and the systemd service name with its suffix. pub const SYSTEMD_UNIT: &str = "runicgateway-link.service"; @@ -149,7 +151,7 @@ fn prepare_platform() -> Prepared { /// Creates the dedicated system user if it is not already there. Returns whether it created it. #[cfg(unix)] fn ensure_user(user: &str) -> Result { - if run("id", &["-u", user]).map(|o| o.status.success()) == Ok(true) { + if run("id", &["-u", user]).is_ok_and(|o| o.status.success()) { return Ok(false); } // `useradd` is the near-universal spelling; `adduser` is the fallback for Debian's wrapper and @@ -373,7 +375,7 @@ fn register_windows(binary: &Path, config: &Path, restart: bool) -> Result