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 c6efd3661f
Signed by: NotAShelf
GPG key ID: 29D95B64378DB4BF
53 changed files with 343 additions and 394 deletions

View file

@ -31,6 +31,7 @@ blake3 = { workspace = true }
rand = { workspace = true }
percent-encoding = { workspace = true }
http = { workspace = true }
rustc-hash = { workspace = true }
[lints]
workspace = true

View file

@ -1,9 +1,7 @@
use std::{
collections::HashMap,
path::{Path, PathBuf},
};
use std::path::{Path, PathBuf};
use chrono::{DateTime, Utc};
use rustc_hash::FxHashMap;
use serde::{Deserialize, Serialize};
use uuid::Uuid;
@ -52,7 +50,7 @@ pub struct MediaResponse {
pub duration_secs: Option<f64>,
pub description: Option<String>,
pub has_thumbnail: bool,
pub custom_fields: HashMap<String, CustomFieldResponse>,
pub custom_fields: FxHashMap<String, CustomFieldResponse>,
// Photo-specific metadata
pub date_taken: Option<DateTime<Utc>>,

View file

@ -17,6 +17,7 @@ use pinakes_core::{
ReadingStatus,
},
};
use rustc_hash::FxHashMap;
use serde::{Deserialize, Serialize};
use uuid::Uuid;
@ -41,7 +42,7 @@ pub struct BookMetadataResponse {
pub series_index: Option<f64>,
pub format: Option<String>,
pub authors: Vec<AuthorResponse>,
pub identifiers: std::collections::HashMap<String, Vec<String>>,
pub identifiers: FxHashMap<String, Vec<String>>,
}
impl From<BookMetadata> for BookMetadataResponse {

View file

@ -3,6 +3,7 @@ use axum::{
extract::{Path, Query, State},
};
use pinakes_core::{model::MediaId, storage::DynStorageBackend};
use rustc_hash::FxHashMap;
use uuid::Uuid;
use crate::{
@ -1249,7 +1250,7 @@ pub async fn empty_trash(
pub async fn permanent_delete_media(
State(state): State<AppState>,
Path(id): Path<Uuid>,
Query(params): Query<std::collections::HashMap<String, String>>,
Query(params): Query<FxHashMap<String, String>>,
) -> Result<Json<serde_json::Value>, ApiError> {
let media_id = MediaId(id);
let permanent = params.get("permanent").is_some_and(|v| v == "true");

View file

@ -1,5 +1,3 @@
use std::collections::HashMap;
use axum::{
Json,
Router,
@ -91,8 +89,10 @@ pub async fn get_timeline(
.collect();
// Group by the requested period
let mut groups: HashMap<String, Vec<pinakes_core::model::MediaItem>> =
HashMap::new();
let mut groups: rustc_hash::FxHashMap<
String,
Vec<pinakes_core::model::MediaItem>,
> = rustc_hash::FxHashMap::default();
for photo in photos {
if let Some(date_taken) = photo.date_taken {

View file

@ -1,10 +1,11 @@
use std::{collections::HashMap, sync::Arc};
use std::sync::Arc;
use axum::{
Json,
extract::{Path, State},
};
use pinakes_core::plugin::PluginManager;
use rustc_hash::FxHashMap;
use crate::{
dto::{
@ -194,7 +195,7 @@ pub async fn emit_plugin_event(
/// List merged CSS custom property overrides from all enabled plugins
pub async fn list_plugin_ui_theme_extensions(
State(state): State<AppState>,
) -> Result<Json<HashMap<String, String>>, ApiError> {
) -> Result<Json<FxHashMap<String, String>>, ApiError> {
let plugin_manager = require_plugin_manager(&state)?;
Ok(Json(plugin_manager.list_ui_theme_extensions().await))
}

View file

@ -51,14 +51,15 @@ pub async fn create_saved_search(
));
}
if let Some(ref sort) = req.sort_order
&& !VALID_SORT_ORDERS.contains(&sort.as_str()) {
return Err(ApiError(
pinakes_core::error::PinakesError::InvalidOperation(format!(
"sort_order must be one of: {}",
VALID_SORT_ORDERS.join(", ")
)),
));
}
&& !VALID_SORT_ORDERS.contains(&sort.as_str())
{
return Err(ApiError(
pinakes_core::error::PinakesError::InvalidOperation(format!(
"sort_order must be one of: {}",
VALID_SORT_ORDERS.join(", ")
)),
));
}
let id = uuid::Uuid::now_v7();
state
.storage