diff --git a/crates/neon/src/handle/mod.rs b/crates/neon/src/handle/mod.rs index 06fb134cf..2994e9998 100644 --- a/crates/neon/src/handle/mod.rs +++ b/crates/neon/src/handle/mod.rs @@ -80,10 +80,7 @@ pub struct Handle<'a, V: Value + 'a> { impl<'a, V: Value> Clone for Handle<'a, V> { fn clone(&self) -> Self { - Self { - value: self.value, - phantom: PhantomData, - } + *self } } diff --git a/crates/neon/src/types_impl/boxed.rs b/crates/neon/src/types_impl/boxed.rs index 4306bbed5..990ce83cf 100644 --- a/crates/neon/src/types_impl/boxed.rs +++ b/crates/neon/src/types_impl/boxed.rs @@ -164,10 +164,7 @@ unsafe fn maybe_external_deref<'a>(env: Env, local: raw::Local) -> Option<&'a Bo // Custom `Clone` implementation since `T` might not be `Clone` impl Clone for JsBoxInner { fn clone(&self) -> Self { - Self { - local: self.local, - raw_data: self.raw_data, - } + *self } } diff --git a/crates/neon/src/types_impl/promise.rs b/crates/neon/src/types_impl/promise.rs index 9cf5b0285..e523e6f38 100644 --- a/crates/neon/src/types_impl/promise.rs +++ b/crates/neon/src/types_impl/promise.rs @@ -186,7 +186,6 @@ impl JsPromise { + 'static, { let then = self.get::(cx, "then")?; - let catch = self.get::(cx, "catch")?; let (tx, rx) = oneshot::channel(); let take_state = { @@ -235,8 +234,11 @@ impl JsPromise { } })?; - then.exec(cx, Handle::new_internal(Self(self.0)), [resolve.upcast()])?; - catch.exec(cx, Handle::new_internal(Self(self.0)), [reject.upcast()])?; + then.exec( + cx, + Handle::new_internal(Self(self.0)), + [resolve.upcast(), reject.upcast()], + )?; Ok(JsFuture { rx }) }