diff options
| author | 魏曹先生 <1992414357@qq.com> | 2026-08-03 01:37:34 +0800 |
|---|---|---|
| committer | 魏曹先生 <1992414357@qq.com> | 2026-08-03 01:37:34 +0800 |
| commit | c078df6c97d13240d8f8bbaa0d86e830a5b71b4c (patch) | |
| tree | 620a90a4a2e3ff35c2f62960bc03447e4ab08356 /mingling_macros/src | |
| parent | 9b14d4881ddabc0411c90f51439af59b004c9cd5 (diff) | |
refactor: simplify boolean and type assignment logic
Diffstat (limited to 'mingling_macros/src')
| -rw-r--r-- | mingling_macros/src/attr/command.rs | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/mingling_macros/src/attr/command.rs b/mingling_macros/src/attr/command.rs index 35c5c30..9598fa8 100644 --- a/mingling_macros/src/attr/command.rs +++ b/mingling_macros/src/attr/command.rs @@ -179,7 +179,7 @@ fn build_ext_attrs(exts: &[syn::Path]) -> Vec<TokenStream2> { /// Returns `true` if the function has a first non-reference (owned) parameter that /// serves as the "args" input. fn has_args_param(sig: &syn::Signature) -> bool { - sig.inputs.first().map_or(false, |arg| { + sig.inputs.first().is_some_and(|arg| { if let FnArg::Typed(pat_type) = arg { !matches!(&*pat_type.ty, Type::Reference(_)) } else { @@ -202,10 +202,10 @@ fn build_wrapper_params( // First param is owned (args) -> replace its type with entry type let mut params = sig.inputs.clone(); if let Some(FnArg::Typed(first)) = params.first_mut() { - first.ty = Box::new(Type::Path(syn::TypePath { + *first.ty = Type::Path(syn::TypePath { qself: None, path: syn::Path::from(entry_type.clone()), - })); + }); } params } else { |
