Watch
0
0
Fork
You've already forked hyperhive
0

remove as_str() legacy wrappers, callers use .into() directly

This commit is contained in:
damocles 2026-09-11 21:55:04 +02:00
commit 46456f75ce

View file

@ -38,10 +38,6 @@ pub enum Wanted {
}
impl Wanted {
pub fn as_str(self) -> &'static str {
self.into()
}
/// Derived (`strum::EnumString`, the same `snake_case` convention
/// `as_str` uses) rather than a hand-written match kept in sync with
/// it by hand.
@ -138,7 +134,7 @@ impl PowerStore {
conn.execute(
"INSERT INTO agent_power (agent, wanted, updated_at) VALUES (?1, ?2, ?3)
ON CONFLICT(agent) DO UPDATE SET wanted = ?2, updated_at = ?3",
params![agent, wanted.as_str(), Utc::now().timestamp()],
params![agent, <&str>::from(wanted), Utc::now().timestamp()],
)
.context("upsert agent_power")?;
Ok(())
@ -154,7 +150,7 @@ impl PowerStore {
}
let seeded = Wanted::from_running(running);
self.set(agent, seeded)?;
tracing::info!(%agent, wanted = seeded.as_str(), "agent_power: seeded from observed state");
tracing::info!(%agent, wanted = <&str>::from(seeded), "agent_power: seeded from observed state");
Ok(seeded)
}