refactor: update empty hashmap initialization with lazy initialization

Co-authored-by: aider (openai/andrew/openrouter/deepseek/deepseek-chat-v3.1) <aider@aider.chat>
This commit is contained in:
Andrew Phillips
2025-08-26 18:06:50 -03:00
parent 3fb436dc44
commit 1d463323ce
5 changed files with 13 additions and 8 deletions

View File

@@ -196,7 +196,9 @@ pub trait MetaPlugin {
// Access to outputs mapping with default implementation
fn outputs(&self) -> &std::collections::HashMap<String, serde_yaml::Value> {
static EMPTY: std::collections::HashMap<String, serde_yaml::Value> = std::collections::HashMap::new();
use once_cell::sync::Lazy;
static EMPTY: Lazy<std::collections::HashMap<String, serde_yaml::Value>> =
Lazy::new(|| std::collections::HashMap::new());
&EMPTY
}
@@ -206,7 +208,9 @@ pub trait MetaPlugin {
// Access to options mapping with default implementation
fn options(&self) -> &std::collections::HashMap<String, serde_yaml::Value> {
static EMPTY: std::collections::HashMap<String, serde_yaml::Value> = std::collections::HashMap::new();
use once_cell::sync::Lazy;
static EMPTY: Lazy<std::collections::HashMap<String, serde_yaml::Value>> =
Lazy::new(|| std::collections::HashMap::new());
&EMPTY
}