From e95f7715bca396dafa8891d8bb22158fc70692ea Mon Sep 17 00:00:00 2001 From: Raul Jordan Date: Mon, 23 Dec 2024 13:20:05 -0600 Subject: [PATCH 1/2] enforce fallback no args return type --- stylus-proc/src/macros/public/types.rs | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/stylus-proc/src/macros/public/types.rs b/stylus-proc/src/macros/public/types.rs index 5088166e..0367e363 100644 --- a/stylus-proc/src/macros/public/types.rs +++ b/stylus-proc/src/macros/public/types.rs @@ -333,10 +333,9 @@ impl PublicFn { if matches!(self.kind, FnKind::FallbackNoArgs) { return parse_quote! { return Some({ - if let Err(err) = Self::#name(#storage_arg) { - Err(err) - } else { - Ok(Vec::new()) + match Self::#name(#storage_arg) { + Ok(()) => Ok(Vec::new()), + Err(err) => Err(err), } }); }; From fc603d1d69034d7079ba81235c2272b075326194 Mon Sep 17 00:00:00 2001 From: Raul Jordan Date: Wed, 19 Mar 2025 14:19:00 -0500 Subject: [PATCH 2/2] clippy --- stylus-proc/src/macros/public/mod.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/stylus-proc/src/macros/public/mod.rs b/stylus-proc/src/macros/public/mod.rs index 0fe7dbff..ea0a2bec 100644 --- a/stylus-proc/src/macros/public/mod.rs +++ b/stylus-proc/src/macros/public/mod.rs @@ -228,7 +228,7 @@ impl From<&syn::FnArg> for PublicFnArg { } fn check_fallback_signature(sig: Signature) { - let has_input_args = sig.inputs.len() > 0; + let has_input_args = !sig.inputs.is_empty(); let has_output = !matches!(sig.output, ReturnType::Default); if has_input_args {