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
25 changed files with 46 additions and 128 deletions

View file

@ -719,7 +719,7 @@ fn render(declaration: &swarm_queue_client::wanted::HiveWanted) -> Vec<AgentDecl
.iter()
.map(|(agent, wanted)| AgentDeclaration {
agent: agent.clone(),
state: wanted.state.as_str().to_owned(),
state: <&str>::from(wanted.state).to_owned(),
})
.collect()
}
@ -1000,7 +1000,7 @@ async fn get_agents_status(
.get(hive)?
.agents
.get(&row.name)
.map(|w| w.state.as_str().to_owned())
.map(|w| <&str>::from(w.state).to_owned())
});
}
}

View file

@ -215,7 +215,7 @@ impl DeliveryKind {
format!(
"{}{ROUTE_PREFIX}{}",
public_base.trim_end_matches('/'),
self.as_str()
<&str>::from(self)
)
}
@ -229,18 +229,6 @@ impl DeliveryKind {
fn parse(segment: &str) -> Option<Self> {
segment.parse().ok()
}
/// Stable string form, used for logging. Deliberately the same spelling
/// as the path segment so a journal line can be matched against a
/// registered URL.
///
/// ⚠️ **Not the routing key for the swarm→hive message.** That message is
/// semantic (*knowledge repo changed*, *deploy agent X at rev Y*) and is
/// addressed to the hives that need it; which hook a delivery arrived on
/// is an input to deriving it, not the thing sent.
fn as_str(self) -> &'static str {
self.into()
}
}
/// Why a delivery was refused.
@ -377,7 +365,7 @@ pub(super) async fn post_webhook_forge(
};
tracing::info!(
kind = kind.as_str(),
kind = <&str>::from(kind),
bytes = body.len(),
"webhook: verified delivery"
);