From 2aa7bda3cb21ce6c052b82e08bcab79a625d04f2 Mon Sep 17 00:00:00 2001 From: Weicao-CatilGrass <1992414357@qq.com> Date: Sun, 31 May 2026 02:42:52 +0800 Subject: Enhance code quality across the entire codebase --- mingling_macros/src/dispatch_tree_gen.rs | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) (limited to 'mingling_macros/src/dispatch_tree_gen.rs') diff --git a/mingling_macros/src/dispatch_tree_gen.rs b/mingling_macros/src/dispatch_tree_gen.rs index a2cd52c..66fb6e7 100644 --- a/mingling_macros/src/dispatch_tree_gen.rs +++ b/mingling_macros/src/dispatch_tree_gen.rs @@ -43,7 +43,7 @@ pub fn gen_dispatch_args_trie(entries: &[(String, String, String)]) -> TokenStre quote! { fn dispatch_args_trie( - raw: &Vec, + raw: &[String], ) -> Result<::mingling::AnyOutput, ::mingling::error::ProgramInternalExecuteError> { let raw_string = format!("{} ", raw.join(" ")); @@ -63,7 +63,7 @@ pub fn gen_dispatch_args_trie(entries: &[(String, String, String)]) -> TokenStre fn build_dispatch_body(nodes: &[(String, String)], depth: usize) -> TokenStream { if nodes.is_empty() { return quote! { - return Ok(Self::build_dispatcher_not_found(raw.clone())); + return Ok(Self::build_dispatcher_not_found(raw.to_vec())); }; } @@ -121,7 +121,7 @@ fn build_dispatch_body(nodes: &[(String, String)], depth: usize) -> TokenStream arms.push(quote! { Some(#ch_char) => { #arm - return Ok(Self::build_dispatcher_not_found(raw.clone())); + return Ok(Self::build_dispatcher_not_found(raw.to_vec())); } }); } else { @@ -150,7 +150,7 @@ fn build_dispatch_body(nodes: &[(String, String)], depth: usize) -> TokenStream let match_body = quote! { match raw_chars.nth(0) { #(#arms)* - _ => return Ok(Self::build_dispatcher_not_found(raw.clone())), + _ => return Ok(Self::build_dispatcher_not_found(raw.to_vec())), } }; quote! { @@ -161,19 +161,19 @@ fn build_dispatch_body(nodes: &[(String, String)], depth: usize) -> TokenStream // Only exact nodes, no deeper groups quote! { #(#exact_checks)* - return Ok(Self::build_dispatcher_not_found(raw.clone())); + return Ok(Self::build_dispatcher_not_found(raw.to_vec())); } } else if arms.is_empty() { // Only fallback (shouldn't happen if nodes is non-empty) quote! { - return Ok(Self::build_dispatcher_not_found(raw.clone())); + return Ok(Self::build_dispatcher_not_found(raw.to_vec())); } } else { // Only group arms quote! { match raw_chars.nth(0) { #(#arms)* - _ => return Ok(Self::build_dispatcher_not_found(raw.clone())), + _ => return Ok(Self::build_dispatcher_not_found(raw.to_vec())), } } } -- cgit