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

@ -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.