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
|
|
@ -385,7 +385,7 @@ fn run_set_wanted(coord: &Arc<Coordinator>, agent: &str, up: bool) -> Result<()>
|
|||
coord
|
||||
.power
|
||||
.set(agent, wanted)
|
||||
.with_context(|| format!("set wanted={} for agent {agent}", wanted.as_str()))?;
|
||||
.with_context(|| format!("set wanted={} for agent {agent}", <&str>::from(wanted)))?;
|
||||
Ok(())
|
||||
}
|
||||
|
||||
|
|
@ -579,7 +579,7 @@ async fn run_reconcile(coord: &Arc<Coordinator>, name: &str) -> Result<Option<No
|
|||
agent: name.to_owned(),
|
||||
}),
|
||||
ReconcileAction::Noop => {
|
||||
tracing::debug!(%name, wanted = wanted.as_str(), running, "reconcile: noop");
|
||||
tracing::debug!(%name, wanted = <&str>::from(wanted), running, "reconcile: noop");
|
||||
None
|
||||
}
|
||||
})
|
||||
|
|
|
|||
|
|
@ -313,7 +313,7 @@ impl JobQueue {
|
|||
}
|
||||
Some(RunningTransient {
|
||||
agent: agent.to_owned(),
|
||||
label: n.payload.as_str().to_owned(),
|
||||
label: <&str>::from(&n.payload).to_owned(),
|
||||
takes_container_down: n.payload.takes_container_down(),
|
||||
// `started_at` is set when a node enters `Running`, and this
|
||||
// only sees `Running` nodes — the fallback is unreachable in
|
||||
|
|
|
|||
|
|
@ -170,7 +170,7 @@ pub enum NodeKind {
|
|||
/// renders it without knowing what any of it means.
|
||||
impl hive_jobq_wire::WireNode for NodeKind {
|
||||
fn label(&self) -> String {
|
||||
self.as_str().to_owned()
|
||||
<&str>::from(self).to_owned()
|
||||
}
|
||||
|
||||
fn data(&self, id: hive_jobq_wire::WireId) -> serde_json::Value {
|
||||
|
|
@ -201,16 +201,6 @@ impl hive_jobq_wire::WireNode for NodeKind {
|
|||
}
|
||||
|
||||
impl NodeKind {
|
||||
/// Wire string for the node's label on the graph wire
|
||||
/// ([`hive_jobq_wire::WireNode::label`]) — derived
|
||||
/// (`#[strum(serialize_all = "snake_case")]`), matching the same
|
||||
/// convention the `#[serde(rename_all = "snake_case")]` tag above
|
||||
/// uses, rather than a 31-arm hand-written match kept in sync with it
|
||||
/// by hand.
|
||||
pub fn as_str(&self) -> &'static str {
|
||||
self.into()
|
||||
}
|
||||
|
||||
/// The agent this node targets, or `""` for agentless kinds
|
||||
/// ([`NodeKind::MetaLock`] on the `hyperhive` pseudo-agent,
|
||||
/// [`NodeKind::Reparent`] which can span multiple agents, and
|
||||
|
|
|
|||
|
|
@ -92,10 +92,11 @@ pub async fn run_worker(coord: Arc<Coordinator>) {
|
|||
hive_jobq::scheduler::Scheduler::claim_next(&sched, move |id, kind, builder| {
|
||||
let coord = node_coord;
|
||||
async move {
|
||||
let kind_str = <&str>::from(&kind);
|
||||
tracing::info!(
|
||||
dag = coord.job_queue.root_of(id).unwrap_or_default(),
|
||||
node = id.get(),
|
||||
kind = kind.as_str(),
|
||||
kind = kind_str,
|
||||
agent = %kind.agent(),
|
||||
"job_queue: node running"
|
||||
);
|
||||
|
|
@ -104,7 +105,7 @@ pub async fn run_worker(coord: Arc<Coordinator>) {
|
|||
Ok(()) => tracing::info!(node = id.get(), "job_queue: node done"),
|
||||
Err(e) => tracing::warn!(
|
||||
node = id.get(),
|
||||
kind = kind.as_str(),
|
||||
kind = kind_str,
|
||||
agent = %kind.agent(),
|
||||
error = %format!("{e:#}"),
|
||||
grown_nodes = !grown.is_empty(),
|
||||
|
|
|
|||
|
|
@ -862,7 +862,7 @@ fn rebuild_chain_nodes_suppress_crash_watch() {
|
|||
kind.takes_container_down(),
|
||||
"{} must suppress crash-watch — a rebuild takes the container down \
|
||||
on purpose",
|
||||
kind.as_str()
|
||||
<&str>::from(&kind)
|
||||
);
|
||||
}
|
||||
// The counter-case, and the reason this can't be "any node in a rebuild":
|
||||
|
|
|
|||
Loading…
Reference in a new issue