remove as_str() legacy wrappers, callers use .into() directly
This commit is contained in:
parent
299add158f
commit
46456f75ce
25 changed files with 46 additions and 128 deletions
|
|
@ -93,7 +93,7 @@ impl Approvals {
|
|||
VALUES (?1, ?2, ?3, ?4, 'pending', ?5, ?6, ?7)",
|
||||
params![
|
||||
agent,
|
||||
kind.as_str(),
|
||||
<&str>::from(kind),
|
||||
commit_ref,
|
||||
Utc::now().timestamp(),
|
||||
description,
|
||||
|
|
|
|||
|
|
@ -100,12 +100,6 @@ pub enum BuildStatus {
|
|||
Fail,
|
||||
}
|
||||
|
||||
impl BuildStatus {
|
||||
fn as_str(self) -> &'static str {
|
||||
self.into()
|
||||
}
|
||||
}
|
||||
|
||||
/// Header-only row returned by `list_recent_for_agent`. Carries the
|
||||
/// metadata the dashboard's agent-card chip needs (status + age +
|
||||
/// id-to-open) without the multi-MB stdout/stderr payload.
|
||||
|
|
@ -278,7 +272,7 @@ impl BuildLogs {
|
|||
let conn = self.conn.lock().unwrap();
|
||||
if let Err(e) = conn.execute(
|
||||
"UPDATE build_logs SET finished_at = ?1, status = ?2 WHERE id = ?3",
|
||||
params![now, status.as_str(), id],
|
||||
params![now, <&str>::from(status), id],
|
||||
) {
|
||||
tracing::warn!(
|
||||
build_log_id = id,
|
||||
|
|
|
|||
|
|
@ -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)
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue