summaryrefslogtreecommitdiff
path: root/src/systems/cmd/processer.rs
diff options
context:
space:
mode:
author魏曹先生 <1992414357@qq.com>2026-03-20 22:21:56 +0800
committer魏曹先生 <1992414357@qq.com>2026-03-20 22:21:56 +0800
commitab6be7968b25afb57fc428695693484ad8576718 (patch)
treee4af27964f195a18a678844dbe71c0aaa182b5dc /src/systems/cmd/processer.rs
parent6b22f7b7694fce530f84ba94c65c057450cca626 (diff)
Refactor code to use modern Rust idioms and fix clippy lints
Diffstat (limited to 'src/systems/cmd/processer.rs')
-rw-r--r--src/systems/cmd/processer.rs10
1 files changed, 5 insertions, 5 deletions
diff --git a/src/systems/cmd/processer.rs b/src/systems/cmd/processer.rs
index aa494bb..2b66eef 100644
--- a/src/systems/cmd/processer.rs
+++ b/src/systems/cmd/processer.rs
@@ -8,7 +8,7 @@ use crate::systems::cmd::errors::CmdProcessError;
use crate::systems::render::renderer::JVRenderResult;
pub async fn jv_cmd_process(
- args: &Vec<String>,
+ args: &[String],
ctx: JVCommandContext,
renderer_override: String,
) -> Result<JVRenderResult, CmdProcessError> {
@@ -22,7 +22,7 @@ pub async fn jv_cmd_process(
}
async fn process(
- args: &Vec<String>,
+ args: &[String],
ctx: JVCommandContext,
renderer_override: String,
) -> Result<JVRenderResult, CmdProcessError> {
@@ -48,7 +48,7 @@ async fn process(
0 => {
// No matching node found
error!("{}", t!("verbose.cmd_match_no_node"));
- return Err(CmdProcessError::NoMatchingCommand);
+ Err(CmdProcessError::NoMatchingCommand)
}
1 => {
let matched_prefix = matching_nodes[0];
@@ -60,7 +60,7 @@ async fn process(
);
let prefix_len = matched_prefix.split_whitespace().count();
- let trimmed_args: Vec<String> = args.into_iter().cloned().skip(prefix_len).collect();
+ let trimmed_args: Vec<String> = args.iter().skip(prefix_len).cloned().collect();
return jv_cmd_process_node(matched_prefix, trimmed_args, ctx, renderer_override).await;
}
_ => {
@@ -84,7 +84,7 @@ async fn process(
);
let prefix_len = matched_prefix.split_whitespace().count();
- let trimmed_args: Vec<String> = args.into_iter().cloned().skip(prefix_len).collect();
+ let trimmed_args: Vec<String> = args.iter().skip(prefix_len).cloned().collect();
return jv_cmd_process_node(matched_prefix, trimmed_args, ctx, renderer_override).await;
}
}