diff options
| author | Weicao-CatilGrass <1992414357@qq.com> | 2026-05-31 02:42:52 +0800 |
|---|---|---|
| committer | 魏曹先生 <1992414357@qq.com> | 2026-05-31 17:19:20 +0800 |
| commit | 2aa7bda3cb21ce6c052b82e08bcab79a625d04f2 (patch) | |
| tree | f10b89007fc67ca1a948f34abe6869b49296b932 /mingling_macros/src/dispatch_tree_gen.rs | |
| parent | 3aa409a55e4f2f0ab41b0949cc06eb13c2da4a43 (diff) | |
Enhance code quality across the entire codebase
Diffstat (limited to 'mingling_macros/src/dispatch_tree_gen.rs')
| -rw-r--r-- | mingling_macros/src/dispatch_tree_gen.rs | 14 |
1 files changed, 7 insertions, 7 deletions
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<String>, + raw: &[String], ) -> Result<::mingling::AnyOutput<Self::Enum>, ::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())), } } } |
