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:
parent
d73bb4580d
commit
f831e58723
53 changed files with 343 additions and 394 deletions
|
|
@ -1,7 +1,8 @@
|
|||
//! Plugin manifest parsing and validation
|
||||
|
||||
use std::{collections::HashMap, path::Path};
|
||||
use std::path::Path;
|
||||
|
||||
use rustc_hash::FxHashMap;
|
||||
use serde::{Deserialize, Serialize};
|
||||
use thiserror::Error;
|
||||
|
||||
|
|
@ -23,7 +24,7 @@ pub struct PluginManifest {
|
|||
pub capabilities: ManifestCapabilities,
|
||||
|
||||
#[serde(default)]
|
||||
pub config: HashMap<String, toml::Value>,
|
||||
pub config: FxHashMap<String, toml::Value>,
|
||||
|
||||
/// UI pages provided by this plugin
|
||||
#[serde(default)]
|
||||
|
|
@ -49,8 +50,8 @@ pub struct UiSection {
|
|||
/// CSS custom property overrides provided by this plugin.
|
||||
/// Keys are property names (e.g. `--accent-color`), values are CSS values.
|
||||
/// The host applies these to `document.documentElement` on startup.
|
||||
#[serde(default, skip_serializing_if = "HashMap::is_empty")]
|
||||
pub theme_extensions: HashMap<String, String>,
|
||||
#[serde(default, skip_serializing_if = "FxHashMap::is_empty")]
|
||||
pub theme_extensions: FxHashMap<String, String>,
|
||||
}
|
||||
|
||||
impl UiSection {
|
||||
|
|
@ -709,7 +710,7 @@ gap = 16
|
|||
"/api/v1/media".to_string(),
|
||||
"/api/plugins/my-plugin/data".to_string(),
|
||||
],
|
||||
theme_extensions: HashMap::new(),
|
||||
theme_extensions: FxHashMap::default(),
|
||||
};
|
||||
assert!(section.validate().is_ok());
|
||||
}
|
||||
|
|
@ -720,7 +721,7 @@ gap = 16
|
|||
pages: vec![],
|
||||
widgets: vec![],
|
||||
required_endpoints: vec!["/not-api/something".to_string()],
|
||||
theme_extensions: HashMap::new(),
|
||||
theme_extensions: FxHashMap::default(),
|
||||
};
|
||||
assert!(section.validate().is_err());
|
||||
}
|
||||
|
|
@ -731,7 +732,7 @@ gap = 16
|
|||
pages: vec![],
|
||||
widgets: vec![],
|
||||
required_endpoints: vec!["/api/ok".to_string(), "no-slash".to_string()],
|
||||
theme_extensions: HashMap::new(),
|
||||
theme_extensions: FxHashMap::default(),
|
||||
};
|
||||
let err = section.validate().unwrap_err();
|
||||
assert!(
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue