refactor: simplify filter plugin signatures by removing boxed parameters
This commit is contained in:
committed by
Andrew Phillips (aider)
parent
9c354d5ef4
commit
059bde09e4
@@ -278,10 +278,9 @@ impl MetaPlugin for MetaPluginExec {
|
||||
///
|
||||
/// * `MetaPluginResponse` - Empty metadata, not finalized.
|
||||
fn update(&mut self, data: &[u8]) -> MetaPluginResponse {
|
||||
if let Some(ref mut writer) = self.writer {
|
||||
if let Err(e) = writer.write_all(data) {
|
||||
debug!("META: Failed to write to process stdin: {}", e);
|
||||
}
|
||||
if let Some(ref mut writer) = self.writer
|
||||
&& let Err(e) = writer.write_all(data) {
|
||||
debug!("META: Failed to write to process stdin: {}", e);
|
||||
}
|
||||
MetaPluginResponse {
|
||||
metadata: Vec::new(),
|
||||
@@ -377,25 +376,22 @@ fn register_exec_plugin() {
|
||||
let mut split_whitespace = true;
|
||||
|
||||
if let Some(opts) = &options {
|
||||
if let Some(command_value) = opts.get("command") {
|
||||
if let Some(command_str) = command_value.as_str() {
|
||||
let parts: Vec<&str> = command_str.split_whitespace().collect();
|
||||
if !parts.is_empty() {
|
||||
program_name = parts[0].to_string();
|
||||
args = parts[1..].iter().map(|s| s.to_string()).collect();
|
||||
}
|
||||
if let Some(command_value) = opts.get("command")
|
||||
&& let Some(command_str) = command_value.as_str() {
|
||||
let parts: Vec<&str> = command_str.split_whitespace().collect();
|
||||
if !parts.is_empty() {
|
||||
program_name = parts[0].to_string();
|
||||
args = parts[1..].iter().map(|s| s.to_string()).collect();
|
||||
}
|
||||
}
|
||||
// Handle other options if needed
|
||||
if let Some(split_value) = opts.get("split_whitespace") {
|
||||
if let Some(split_bool) = split_value.as_bool() {
|
||||
split_whitespace = split_bool;
|
||||
}
|
||||
if let Some(split_value) = opts.get("split_whitespace")
|
||||
&& let Some(split_bool) = split_value.as_bool() {
|
||||
split_whitespace = split_bool;
|
||||
}
|
||||
if let Some(name_value) = opts.get("name") {
|
||||
if let Some(name_str) = name_value.as_str() {
|
||||
meta_name = name_str.to_string();
|
||||
}
|
||||
if let Some(name_value) = opts.get("name")
|
||||
&& let Some(name_str) = name_value.as_str() {
|
||||
meta_name = name_str.to_string();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -406,4 +402,4 @@ fn register_exec_plugin() {
|
||||
options,
|
||||
outputs))
|
||||
});
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user