fix(#999): resolve all clippy warnings across the workspace

All crates now pass `cargo clippy --workspace -- -D warnings` cleanly.

Fixes span six crates (hive-sh4re, hive-ag3nt, hive-c0re, hive-forge,
hive-priv, hive-matrix-mcp was already clean):

- doc_markdown: wrap snake_case, type names, constants in backticks
- collapsible_if / collapsible_match: fold nested ifs into let-chains
- duration_suboptimal_units: Duration::from_secs(N) → from_mins/from_hours
- implicit_hasher: allow on HashMap-param fns where generalization is risky
- items_after_statements: hoist use to function tops
- map(f).unwrap_or(x) → map_or(x, f); map(f).unwrap_or_else(g) → map_or_else
- is_ok_and / is_none_or in place of map().unwrap_or(bool)
- needless_continue: {} instead of continue in loop match arms
- match_same_arms: Ok(None) | Err(_) merged
- format_push_str: write!() instead of push_str(&format!())
- while let replaces loop { let Some(..) = x else { break } }
- struct_excessive_bools / dead_code: allow on purpose-built structs
- too_many_lines / too_many_arguments: allow where refactor not worth it
- unused_async: remove async from poll_once in bash_runner
- needless_borrow: fix &repo deref in hive-forge comments verb
- cast_possible_truncation: allow u64→usize in fetch_tail

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
atlas 2026-06-01 22:02:21 +02:00 committed by mara
commit 5c5ca38fe8
32 changed files with 121 additions and 127 deletions

View file

@ -181,7 +181,7 @@ async fn port_collision(self_name: &str) -> Option<String> {
None
}
#[allow(clippy::too_many_arguments)]
#[allow(clippy::too_many_arguments, clippy::implicit_hasher)]
pub async fn spawn(
name: &str,
hyperhive_flake: &str,
@ -324,8 +324,7 @@ pub async fn is_running(name: &str) -> bool {
.args(["is-active", "--quiet", &unit])
.status()
.await
.map(|s| s.success())
.unwrap_or(false)
.is_ok_and(|s| s.success())
}
/// Fully tear down a sub-agent's container: stop + remove via `nixos-container
@ -346,7 +345,7 @@ pub async fn destroy(name: &str) -> Result<()> {
Ok(())
}
#[allow(clippy::too_many_arguments)]
#[allow(clippy::too_many_arguments, clippy::implicit_hasher)]
pub async fn rebuild(
name: &str,
hyperhive_flake: &str,
@ -1004,7 +1003,7 @@ fn set_resource_limits(container: &str) -> Result<()> {
std::fs::create_dir_all(&dir).with_context(|| format!("create {dir}"))?;
let path = format!("{dir}/hyperhive-limits.conf");
let content =
format!("[Service]\nMemoryMax={DEFAULT_MEMORY_MAX}\nCPUQuota={DEFAULT_CPU_QUOTA}\n",);
format!("[Service]\nMemoryMax={DEFAULT_MEMORY_MAX}\nCPUQuota={DEFAULT_CPU_QUOTA}\n");
std::fs::write(&path, content).with_context(|| format!("write {path}"))?;
tracing::info!(
%path,
@ -1081,6 +1080,7 @@ fn bind_child_agent_dirs(child: &str, binds: &mut String) {
let _ = write!(binds, " --bind={config_dir}:/agents/{child}/config");
}
#[allow(clippy::too_many_lines)]
fn set_nspawn_flags(
container: &str,
runtime_dir: &Path,
@ -1265,8 +1265,7 @@ async fn run(args: &[&str]) -> Result<()> {
let agent = args
.get(1)
.copied()
.map(|c| c.strip_prefix(AGENT_PREFIX).unwrap_or(c).to_string())
.unwrap_or_else(|| "<unknown>".to_string());
.map_or_else(|| "<unknown>".to_string(), |c| c.strip_prefix(AGENT_PREFIX).unwrap_or(c).to_string());
let logs = crate::build_logs::global();
let log_id = logs.as_ref().and_then(|h| {