clippy: apply auto-fixable warnings across workspace (closes #265 partial)

This commit is contained in:
damocles 2026-05-22 17:50:11 +02:00 committed by Mara
parent 56d0b02c2f
commit 30d82148e0
18 changed files with 83 additions and 102 deletions

View file

@ -65,11 +65,10 @@ pub async fn approve(coord: Arc<Coordinator>, id: i64) -> Result<()> {
if let Err(e) = crate::forge::ensure_config_repo(&approval.agent).await {
tracing::warn!(agent = %approval.agent, error = ?e, "forge: ensure_config_repo after first spawn failed");
}
if let Some(core_token) = crate::forge::core_token() {
if let Err(e) = crate::forge::meta_read_access(&approval.agent, &core_token).await {
if let Some(core_token) = crate::forge::core_token()
&& let Err(e) = crate::forge::meta_read_access(&approval.agent, &core_token).await {
tracing::warn!(agent = %approval.agent, error = ?e, "forge: meta_read_access after first spawn failed");
}
}
if let Err(e) = crate::forge::ensure_meta_remote(&approval.agent).await {
tracing::warn!(agent = %approval.agent, error = ?e, "forge: ensure_meta_remote after first spawn failed");
}
@ -91,11 +90,10 @@ pub async fn approve(coord: Arc<Coordinator>, id: i64) -> Result<()> {
}
.await;
// Wire the meta remote now that the proposed repo exists.
if result.is_ok() {
if let Err(e) = crate::forge::ensure_meta_remote(&approval.agent).await {
if result.is_ok()
&& let Err(e) = crate::forge::ensure_meta_remote(&approval.agent).await {
tracing::warn!(agent = %approval.agent, error = ?e, "forge: ensure_meta_remote after init_config failed");
}
}
finish_approval(&coord, &approval, result, None, false)
}
ApprovalKind::UpdateMetaInputs => {
@ -145,11 +143,10 @@ pub async fn approve(coord: Arc<Coordinator>, id: i64) -> Result<()> {
if let Err(e) = crate::forge::push_config(&agent_bg).await {
tracing::warn!(agent = %agent_bg, error = ?e, "forge: push_config after spawn failed");
}
if let Some(core_token) = crate::forge::core_token() {
if let Err(e) = crate::forge::meta_read_access(&agent_bg, &core_token).await {
if let Some(core_token) = crate::forge::core_token()
&& let Err(e) = crate::forge::meta_read_access(&agent_bg, &core_token).await {
tracing::warn!(agent = %agent_bg, error = ?e, "forge: meta_read_access after spawn failed");
}
}
if let Err(e) = crate::forge::ensure_meta_remote(&agent_bg).await {
tracing::warn!(agent = %agent_bg, error = ?e, "forge: ensure_meta_remote after spawn failed");
}

View file

@ -613,8 +613,7 @@ impl Broker {
let now = std::time::SystemTime::now()
.duration_since(std::time::UNIX_EPOCH)
.ok()
.map(|d| d.as_secs() as i64)
.unwrap_or(0);
.map_or(0, |d| d.as_secs() as i64);
now - since_secs as i64
} else {
i64::MIN

View file

@ -49,7 +49,7 @@ pub struct ContainerView {
#[serde(default)]
pub pending_reminders: u64,
/// Context-window size (prompt tokens) from the agent's most recent
/// completed turn, read directly from the turn-stats SQLite.
/// completed turn, read directly from the turn-stats `SQLite`.
/// `None` when the file is absent or the agent has no turns yet.
/// Stale by up to one crash-watch cycle (~10s); good enough for
/// the "which agent is close to the window?" dashboard glance.
@ -84,7 +84,7 @@ pub async fn build_all(coord: &Coordinator) -> Vec<ContainerView> {
} else {
continue;
};
let deployed_full = locked.get(&format!("agent-{logical}")).map(|s| s.as_str());
let deployed_full = locked.get(&format!("agent-{logical}")).map(std::string::String::as_str);
let needs_update = crate::auto_update::agent_config_pending(&logical, deployed_full);
let needs_login =
!is_manager && !claude_has_session(&Coordinator::agent_claude_dir(&logical));
@ -159,7 +159,7 @@ fn is_rate_limited(name: &str) -> bool {
}
/// Read the most recent completed turn's context-window size (prompt
/// tokens) from the agent's turn-stats SQLite. Returns `None` when
/// tokens) from the agent's turn-stats `SQLite`. Returns `None` when
/// the file is absent or has no rows. Best-effort — any DB error
/// silently yields `None` so a missing/corrupt file never blocks
/// `build_all`.

View file

@ -80,7 +80,7 @@ pub fn spawn(coord: Arc<Coordinator>) {
seeded = true;
tokio::select! {
_ = tokio::time::sleep(POLL_INTERVAL) => {}
() = tokio::time::sleep(POLL_INTERVAL) => {}
_ = shutdown.changed() => {
tracing::info!("crash watcher: shutdown signal received");
break;

View file

@ -29,7 +29,7 @@ pub fn spawn(coord: Arc<Coordinator>) {
loop {
sweep_once();
tokio::select! {
_ = tokio::time::sleep(VACUUM_INTERVAL) => {}
() = tokio::time::sleep(VACUUM_INTERVAL) => {}
_ = shutdown.changed() => {
tracing::info!("events vacuum: shutdown signal received");
break;

View file

@ -54,9 +54,9 @@ const SEEDED_ORGS: &[&str] = &[CONFIG_ORG];
/// a forge namespace).
/// - `read:user` — token-owner endpoint clients call to introspect.
/// - `write:misc` — hooks, attachments, the rest of the long tail.
/// - `read:notification` — required by forge_notify to poll
/// - `read:notification` — required by `forge_notify` to poll
/// `GET /notifications` for unread PR/review events.
/// - `write:notification` — required by forge_notify to mark
/// - `write:notification` — required by `forge_notify` to mark
/// notifications as read via `PATCH /notifications/threads/{id}`.
const TOKEN_SCOPES: &str =
"read:user,write:user,read:notification,write:notification,write:repository,write:issue,write:organization,write:misc";
@ -583,11 +583,10 @@ pub async fn ensure_all() {
}
// Grant read-only access to core/meta and wire the `meta` remote
// into the proposed repo so agents can fetch their deployment context.
if let Some(token) = core_token.as_deref() {
if let Err(e) = meta_read_access(&name, token).await {
if let Some(token) = core_token.as_deref()
&& let Err(e) = meta_read_access(&name, token).await {
tracing::warn!(%name, error = ?e, "forge: ensure_meta_read_access failed");
}
}
if let Err(e) = ensure_meta_remote(&name).await {
tracing::warn!(%name, error = ?e, "forge: ensure_meta_remote failed");
}

View file

@ -176,7 +176,7 @@ async fn main() -> Result<()> {
Err(e) => tracing::warn!(error = ?e, "broker vacuum failed"),
}
tokio::select! {
_ = tokio::time::sleep(interval) => {}
() = tokio::time::sleep(interval) => {}
_ = vacuum_shutdown.changed() => {
tracing::info!("broker vacuum: shutdown signal received");
break;
@ -219,7 +219,7 @@ async fn main() -> Result<()> {
tracing::info!("SIGINT received — requesting shutdown");
coord_sig.request_shutdown();
}
_ = async {
() = async {
let mut sig = tokio::signal::unix::signal(
tokio::signal::unix::SignalKind::terminate()
).expect("failed to install SIGTERM handler");

View file

@ -299,12 +299,11 @@ fn render_flake(
// Forge URL — injected when hive-c0re itself has HIVE_FORGE_URL set
// (the NixOS module derives it from hyperhive.forge.{domain,httpPort}).
// Agents use it in forge_notify to poll Forgejo for PR/review events.
if let Ok(forge_url) = std::env::var("HIVE_FORGE_URL") {
if !forge_url.is_empty() {
if let Ok(forge_url) = std::env::var("HIVE_FORGE_URL")
&& !forge_url.is_empty() {
let escaped = forge_url.replace('\\', "\\\\").replace('"', "\\\"");
let _ = writeln!(out, " HIVE_FORGE_URL = \"{escaped}\";");
}
}
out.push_str(
r#" HYPERHIVE_STATE_DIR = "/agents/${name}/state";
};

View file

@ -57,7 +57,7 @@ pub fn spawn(coord: Arc<Coordinator>) {
loop {
tick(&coord);
tokio::select! {
_ = tokio::time::sleep(POLL_INTERVAL) => {}
() = tokio::time::sleep(POLL_INTERVAL) => {}
_ = shutdown.changed() => {
tracing::info!("reminder scheduler: shutdown signal received");
break;

View file

@ -27,7 +27,7 @@ pub fn spawn(coord: Arc<Coordinator>) {
loop {
sweep_once();
tokio::select! {
_ = tokio::time::sleep(VACUUM_INTERVAL) => {}
() = tokio::time::sleep(VACUUM_INTERVAL) => {}
_ = shutdown.changed() => {
tracing::info!("stats vacuum: shutdown signal received");
break;