fix: cfg-gate udev-check helper functions for Linux host build

- count_status: cfg-gated to Redox only (uses CheckStatus)
- list_dir_names: cfg-gated to Redox only (uses std::fs)

Verified: host cargo check zero warnings, Redox-target make r.redbear-hwutils
builds and publishes successfully (x86_64-unknown-redox).
This commit is contained in:
2026-04-29 13:30:48 +01:00
parent fd09e33430
commit db7c8d1d39
@@ -194,6 +194,7 @@ fn overall_success(report: &Report, config: &Config) -> bool {
checks.iter().all(|c| matches!(c, CheckStatus::Pass(_))) checks.iter().all(|c| matches!(c, CheckStatus::Pass(_)))
} }
#[cfg(target_os = "redox")]
fn count_status(count: usize, label: &str) -> CheckStatus { fn count_status(count: usize, label: &str) -> CheckStatus {
if count > 0 { if count > 0 {
CheckStatus::Pass(format!("{} {} device(s) found", count, label)) CheckStatus::Pass(format!("{} {} device(s) found", count, label))
@@ -202,6 +203,7 @@ fn count_status(count: usize, label: &str) -> CheckStatus {
} }
} }
#[cfg(target_os = "redox")]
fn list_dir_names(path: &str) -> Result<Vec<String>, String> { fn list_dir_names(path: &str) -> Result<Vec<String>, String> {
let entries = fs::read_dir(path).map_err(|err| format!("failed to read {path}: {err}"))?; let entries = fs::read_dir(path).map_err(|err| format!("failed to read {path}: {err}"))?;
let mut names = entries let mut names = entries