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

@@ -55,25 +55,12 @@ impl MetaPlugin for CwdMetaPlugin {
Ok(())
}
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
}
}
@@ -119,25 +106,12 @@ impl MetaPlugin for UidMetaPlugin {
Ok(())
}
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
}
}
@@ -186,25 +160,12 @@ impl MetaPlugin for UserMetaPlugin {
Ok(())
}
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
}
}
@@ -250,25 +211,12 @@ impl MetaPlugin for GidMetaPlugin {
Ok(())
}
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
}
}
@@ -317,25 +265,12 @@ impl MetaPlugin for GroupMetaPlugin {
Ok(())
}
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
}
}
@@ -384,25 +319,12 @@ impl MetaPlugin for ShellMetaPlugin {
Ok(())
}
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
}
}
@@ -451,25 +373,12 @@ impl MetaPlugin for ShellPidMetaPlugin {
Ok(())
}
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
}
}
@@ -515,25 +424,12 @@ impl MetaPlugin for KeepPidMetaPlugin {
Ok(())
}
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
}
}
@@ -582,25 +478,12 @@ impl MetaPlugin for HostnameMetaPlugin {
Ok(())
}
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
}
}
@@ -667,24 +550,11 @@ impl MetaPlugin for FullHostnameMetaPlugin {
Ok(())
}
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
}
}