From 34b21b80386f45de213fd8feb41041dc7f39231c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?m=C3=BCde?= Date: Mon, 6 Jul 2026 21:49:46 +0200 Subject: [PATCH] refactor: drop kind_to_str wrapper, call ApprovalKind::as_str directly --- hive-c0re/src/approvals.rs | 9 +-------- hive-c0re/src/questions.rs | 3 +-- 2 files changed, 2 insertions(+), 10 deletions(-) diff --git a/hive-c0re/src/approvals.rs b/hive-c0re/src/approvals.rs index 3b46dc9d..504d9302 100644 --- a/hive-c0re/src/approvals.rs +++ b/hive-c0re/src/approvals.rs @@ -118,7 +118,7 @@ impl Approvals { VALUES (?1, ?2, ?3, ?4, 'pending', ?5, ?6)", params![ agent, - kind_to_str(kind), + kind.as_str(), commit_ref, now_unix(), description, @@ -410,13 +410,6 @@ fn row_to_approval(row: &rusqlite::Row<'_>) -> rusqlite::Result { }) } -/// Stable kind→str mapping used wherever we emit `ApprovalResolved` -/// or persist a kind to sqlite. Thin alias over -/// [`ApprovalKind::as_str`] (the wire-type owns the mapping) kept for -/// the existing call sites' name. -pub(crate) fn kind_to_str(kind: ApprovalKind) -> &'static str { - kind.as_str() -} fn kind_from_str(s: &str) -> Result { Ok(match s { diff --git a/hive-c0re/src/questions.rs b/hive-c0re/src/questions.rs index ca388839..f6e878a3 100644 --- a/hive-c0re/src/questions.rs +++ b/hive-c0re/src/questions.rs @@ -18,7 +18,6 @@ use std::sync::Arc; -use crate::approvals::kind_to_str; use crate::coordinator::Coordinator; use crate::limits; use crate::socket_server::spawn_question_watchdog; @@ -229,7 +228,7 @@ pub fn handle_cancel_loose_end( coord.emit_approval_resolved(crate::coordinator::ApprovalResolved { id: approval.id, agent: &approval.agent, - approval_kind: kind_to_str(approval.kind), + approval_kind: approval.kind.as_str(), sha_short, status: "cancelled", note: approval.note,