From dd1ffdfedf88673ee0bf85b926f5abff7e79b491 Mon Sep 17 00:00:00 2001 From: Dave Herman Date: Tue, 10 Sep 2024 16:56:54 -0700 Subject: [PATCH] style: move the InvalidArg tag check to a match guard Co-authored-by: K.J. Valencik --- crates/neon/src/types_impl/mod.rs | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/crates/neon/src/types_impl/mod.rs b/crates/neon/src/types_impl/mod.rs index 658e6e10d..9b985b5d1 100644 --- a/crates/neon/src/types_impl/mod.rs +++ b/crates/neon/src/types_impl/mod.rs @@ -1179,11 +1179,8 @@ where ); match status { - sys::Status::InvalidArg => { - if !sys::tag::is_function(env.to_raw(), callee) { - return cx.throw_error("not a function"); - } - panic!("invalid argument"); + sys::Status::InvalidArg if !sys::tag::is_function(env.to_raw(), callee) => { + return cx.throw_error("not a function"); } sys::Status::PendingException => { return Err(Throw::new());