refactor: replace get_* and set_* methods with direct field access

Co-authored-by: aider (openai/andrew/openrouter/anthropic/claude-sonnet-4) <aider@aider.chat>
This commit is contained in:
Andrew Phillips
2025-08-19 13:15:48 -03:00
parent 58ecbd63cf
commit 38cbf06579
7 changed files with 68 additions and 262 deletions

View File

@@ -54,25 +54,12 @@ impl MetaPlugin for DigestSha256MetaPlugin {
self.meta_name.clone()
}
fn configure(&mut self, options: &std::collections::HashMap<String, serde_yaml::Value>) -> Result<()> {
if let Some(outputs) = options.get("outputs") {
if let Some(outputs_map) = outputs.as_mapping() {
for (key, value) in outputs_map {
if let Some(key_str) = key.as_str() {
self.outputs.insert(key_str.to_string(), value.clone());
}
}
}
}
Ok(())
}
fn get_outputs(&self) -> &std::collections::HashMap<String, serde_yaml::Value> {
fn outputs(&self) -> &std::collections::HashMap<String, serde_yaml::Value> {
&self.outputs
}
fn set_outputs(&mut self, outputs: std::collections::HashMap<String, serde_yaml::Value>) {
self.outputs = outputs;
fn outputs_mut(&mut self) -> &mut std::collections::HashMap<String, serde_yaml::Value> {
&mut self.outputs
}
}
@@ -113,25 +100,12 @@ impl MetaPlugin for ReadTimeMetaPlugin {
self.meta_name.clone()
}
fn configure(&mut self, options: &std::collections::HashMap<String, serde_yaml::Value>) -> Result<()> {
if let Some(outputs) = options.get("outputs") {
if let Some(outputs_map) = outputs.as_mapping() {
for (key, value) in outputs_map {
if let Some(key_str) = key.as_str() {
self.outputs.insert(key_str.to_string(), value.clone());
}
}
}
}
Ok(())
}
fn get_outputs(&self) -> &std::collections::HashMap<String, serde_yaml::Value> {
fn outputs(&self) -> &std::collections::HashMap<String, serde_yaml::Value> {
&self.outputs
}
fn set_outputs(&mut self, outputs: std::collections::HashMap<String, serde_yaml::Value>) {
self.outputs = outputs;
fn outputs_mut(&mut self) -> &mut std::collections::HashMap<String, serde_yaml::Value> {
&mut self.outputs
}
}
@@ -174,24 +148,11 @@ impl MetaPlugin for ReadRateMetaPlugin {
self.meta_name.clone()
}
fn configure(&mut self, options: &std::collections::HashMap<String, serde_yaml::Value>) -> Result<()> {
if let Some(outputs) = options.get("outputs") {
if let Some(outputs_map) = outputs.as_mapping() {
for (key, value) in outputs_map {
if let Some(key_str) = key.as_str() {
self.outputs.insert(key_str.to_string(), value.clone());
}
}
}
}
Ok(())
}
fn get_outputs(&self) -> &std::collections::HashMap<String, serde_yaml::Value> {
fn outputs(&self) -> &std::collections::HashMap<String, serde_yaml::Value> {
&self.outputs
}
fn set_outputs(&mut self, outputs: std::collections::HashMap<String, serde_yaml::Value>) {
self.outputs = outputs;
fn outputs_mut(&mut self) -> &mut std::collections::HashMap<String, serde_yaml::Value> {
&mut self.outputs
}
}