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
|
|
@ -105,7 +105,7 @@ pub(super) fn gc_orphans(coord: &Coordinator, approvals: Vec<Approval>) -> Vec<A
|
|||
coord.emit_approval_resolved(crate::coordinator::ApprovalResolved {
|
||||
id: a.id,
|
||||
agent: a.agent.as_str(),
|
||||
approval_kind: a.kind.as_str(),
|
||||
approval_kind: <&str>::from(a.kind),
|
||||
sha_short,
|
||||
status: "failed",
|
||||
note: Some(note.to_owned()),
|
||||
|
|
|
|||
|
|
@ -50,11 +50,11 @@ pub(super) async fn get_tool_groups(
|
|||
) -> axum::Json<ToolGroupsSnapshot> {
|
||||
let groups = hive_sh4re::permissions::ToolGroup::ALL
|
||||
.iter()
|
||||
.map(|g| g.as_str())
|
||||
.map(|g| <&str>::from(*g))
|
||||
.collect();
|
||||
let descriptions = hive_sh4re::permissions::ToolGroup::ALL
|
||||
.iter()
|
||||
.map(|g| (g.as_str(), g.description()))
|
||||
.map(|g| (<&str>::from(*g), g.description()))
|
||||
.collect();
|
||||
let assignments = crate::tool_groups::read();
|
||||
let roster = state
|
||||
|
|
@ -82,7 +82,7 @@ pub(super) async fn get_tool_groups(
|
|||
pub(crate) fn tool_group_default_names() -> Vec<&'static str> {
|
||||
hive_sh4re::permissions::ToolGroup::AGENT_DEFAULT
|
||||
.iter()
|
||||
.map(|g| g.as_str())
|
||||
.map(|g| <&str>::from(*g))
|
||||
.collect()
|
||||
}
|
||||
|
||||
|
|
@ -205,10 +205,10 @@ pub(super) async fn get_capabilities(
|
|||
State(state): State<AppState>,
|
||||
) -> axum::Json<CapabilitiesSnapshot> {
|
||||
use hive_sh4re::permissions::Capability;
|
||||
let caps = Capability::ALL.iter().map(|c| c.as_str()).collect();
|
||||
let caps = Capability::ALL.iter().map(|c| <&str>::from(*c)).collect();
|
||||
let descriptions = Capability::ALL
|
||||
.iter()
|
||||
.map(|c| (c.as_str(), c.description()))
|
||||
.map(|c| (<&str>::from(*c), c.description()))
|
||||
.collect();
|
||||
let assignments = crate::capabilities::read();
|
||||
let roster = state
|
||||
|
|
@ -258,7 +258,7 @@ pub(super) async fn post_capabilities(
|
|||
}
|
||||
let known: Vec<&str> = hive_sh4re::permissions::Capability::ALL
|
||||
.iter()
|
||||
.map(|c| c.as_str())
|
||||
.map(|c| <&str>::from(*c))
|
||||
.collect();
|
||||
for cap in &body.caps {
|
||||
if !known.contains(&cap.as_str()) {
|
||||
|
|
@ -336,7 +336,7 @@ pub(super) async fn post_permissions(
|
|||
) -> Result<Response, ProblemDetails> {
|
||||
let known_caps: Vec<&str> = hive_sh4re::permissions::Capability::ALL
|
||||
.iter()
|
||||
.map(|c| c.as_str())
|
||||
.map(|c| <&str>::from(*c))
|
||||
.collect();
|
||||
// Phase 1 — validate everything before touching any file or the
|
||||
// queue, so a bad entry fails the whole POST with zero side effects.
|
||||
|
|
|
|||
|
|
@ -423,7 +423,7 @@ fn history_view(a: Approval) -> ApprovalHistoryView {
|
|||
// Pending shouldn't appear in recent_resolved, but be defensive.
|
||||
hive_sh4re::approvals::ApprovalStatus::Pending => "pending",
|
||||
};
|
||||
let kind = a.kind.as_str();
|
||||
let kind = <&str>::from(a.kind);
|
||||
ApprovalHistoryView {
|
||||
id: a.id,
|
||||
agent: a.agent.to_string(),
|
||||
|
|
|
|||
Loading…
Reference in a new issue