summaryrefslogtreecommitdiff
path: root/mingling/src/program/exec.rs
diff options
context:
space:
mode:
author魏曹先生 <1992414357@qq.com>2026-03-29 15:00:09 +0800
committer魏曹先生 <1992414357@qq.com>2026-03-29 15:00:09 +0800
commit586c206e50bb8e9a1376f65975f1c9916b1cde7e (patch)
tree7d416ad11b65ab27d3dbf056dfccc1c1cfcde4c4 /mingling/src/program/exec.rs
parent338361a8fca469745454e0f067c93739542d4ff0 (diff)
Apply clippy fixes
Diffstat (limited to 'mingling/src/program/exec.rs')
-rw-r--r--mingling/src/program/exec.rs19
1 files changed, 9 insertions, 10 deletions
diff --git a/mingling/src/program/exec.rs b/mingling/src/program/exec.rs
index 04ed16d..ccdb17b 100644
--- a/mingling/src/program/exec.rs
+++ b/mingling/src/program/exec.rs
@@ -1,3 +1,5 @@
+#![allow(clippy::borrowed_box)]
+
use crate::{
AnyOutput, ChainProcess, Dispatcher, Program, ProgramCollect, RenderResult,
error::{ChainProcessError, ProgramInternalExecuteError},
@@ -48,14 +50,13 @@ pub async fn exec<C: ProgramCollect>(
// If no renderer exists, transfer to the RendererNotFound Dispatcher for execution
else {
let disp: Box<dyn Dispatcher> = Box::new(RendererNotFound);
- let any = match handle_chain_process::<C>(
- disp.begin(vec![format!("{:?}", current.type_id)]),
- ) {
+
+ match handle_chain_process::<C>(disp.begin(vec![format!("{:?}", current.type_id)]))
+ {
Ok(Next::AnyOutput(any)) => any,
Ok(Next::RenderResult(result)) => return Ok(result),
Err(e) => return Err(e),
- };
- any
+ }
}
};
if current.is::<ProgramEnd>() || current.is::<NoChainFound>() {
@@ -70,7 +71,7 @@ pub async fn exec<C: ProgramCollect>(
fn match_user_input<C: ProgramCollect>(
program: &Program<C>,
) -> Result<(&Box<dyn Dispatcher>, Vec<String>), ProgramInternalExecuteError> {
- let nodes = get_nodes(&program);
+ let nodes = get_nodes(program);
let command = format!("{} ", program.args.join(" "));
// Find all nodes that match the command prefix
@@ -121,11 +122,9 @@ fn handle_chain_process<C: ProgramCollect>(
Err(e) => match e {
ChainProcessError::Broken(any_output) => {
let render_result = render::<C>(any_output);
- return Ok(Next::RenderResult(render_result));
- }
- _ => {
- return Err(e.into());
+ Ok(Next::RenderResult(render_result))
}
+ _ => Err(e.into()),
},
}
}