treewide: replace std hashers with rustc_hash alternatives; fix clippy

Signed-off-by: NotAShelf <raf@notashelf.dev>
Change-Id: I766c36cb53d3d7f9e85b91a67c4131a66a6a6964
This commit is contained in:
raf 2026-03-19 22:34:30 +03:00
commit f831e58723
Signed by: NotAShelf
GPG key ID: 29D95B64378DB4BF
53 changed files with 343 additions and 394 deletions

View file

@ -3,8 +3,6 @@
//! This module provides the action execution system that handles
//! user interactions with plugin UI elements.
use std::collections::HashMap;
use pinakes_plugin_api::{
ActionDefinition,
ActionRef,
@ -12,6 +10,7 @@ use pinakes_plugin_api::{
SpecialAction,
UiElement,
};
use rustc_hash::FxHashMap;
use super::data::to_reqwest_method;
use crate::client::ApiClient;
@ -48,7 +47,7 @@ pub enum ActionResult {
pub async fn execute_action(
client: &ApiClient,
action_ref: &ActionRef,
page_actions: &HashMap<String, ActionDefinition>,
page_actions: &FxHashMap<String, ActionDefinition>,
form_data: Option<&serde_json::Value>,
) -> Result<ActionResult, String> {
match action_ref {
@ -224,9 +223,10 @@ mod tests {
async fn test_named_action_unknown_returns_none() {
let client = crate::client::ApiClient::default();
let action_ref = ActionRef::Name("my-action".to_string());
let result = execute_action(&client, &action_ref, &HashMap::new(), None)
.await
.unwrap();
let result =
execute_action(&client, &action_ref, &FxHashMap::default(), None)
.await
.unwrap();
assert!(matches!(result, ActionResult::None));
}
@ -235,11 +235,11 @@ mod tests {
use pinakes_plugin_api::ActionDefinition;
let client = crate::client::ApiClient::default();
let mut page_actions = HashMap::new();
let mut page_actions = FxHashMap::default();
page_actions.insert("do-thing".to_string(), ActionDefinition {
method: pinakes_plugin_api::HttpMethod::Post,
path: "/api/v1/nonexistent-endpoint".to_string(),
params: HashMap::new(),
params: FxHashMap::default(),
success_message: None,
error_message: None,
navigate_to: None,
@ -267,9 +267,10 @@ mod tests {
let client = crate::client::ApiClient::default();
let action_ref = ActionRef::Special(SpecialAction::Refresh);
let result = execute_action(&client, &action_ref, &HashMap::new(), None)
.await
.unwrap();
let result =
execute_action(&client, &action_ref, &FxHashMap::default(), None)
.await
.unwrap();
assert!(matches!(result, ActionResult::Refresh));
}
@ -281,9 +282,10 @@ mod tests {
let action_ref = ActionRef::Special(SpecialAction::Navigate {
to: "/dashboard".to_string(),
});
let result = execute_action(&client, &action_ref, &HashMap::new(), None)
.await
.unwrap();
let result =
execute_action(&client, &action_ref, &FxHashMap::default(), None)
.await
.unwrap();
assert!(
matches!(result, ActionResult::Navigate(ref p) if p == "/dashboard")
);
@ -299,9 +301,10 @@ mod tests {
key: "count".to_string(),
value: expr.clone(),
});
let result = execute_action(&client, &action_ref, &HashMap::new(), None)
.await
.unwrap();
let result =
execute_action(&client, &action_ref, &FxHashMap::default(), None)
.await
.unwrap();
match result {
ActionResult::UpdateState { key, value_expr } => {
assert_eq!(key, "count");
@ -317,9 +320,10 @@ mod tests {
let client = crate::client::ApiClient::default();
let action_ref = ActionRef::Special(SpecialAction::CloseModal);
let result = execute_action(&client, &action_ref, &HashMap::new(), None)
.await
.unwrap();
let result =
execute_action(&client, &action_ref, &FxHashMap::default(), None)
.await
.unwrap();
assert!(matches!(result, ActionResult::CloseModal));
}
}