Skip to content

Commit

Permalink
Remove unnecessary Send bound on closures wrapped in JsFunction
Browse files Browse the repository at this point in the history
  • Loading branch information
kjvalencik committed Nov 11, 2021
1 parent 45e123a commit be6a7ed
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 5 deletions.
4 changes: 2 additions & 2 deletions crates/neon-runtime/src/napi/fun.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ use crate::raw::{Env, Local};

pub unsafe fn new<F>(env: Env, name: &str, callback: F) -> Result<Local, napi::Status>
where
F: Fn(Env, napi::CallbackInfo) -> Local + Send + 'static,
F: Fn(Env, napi::CallbackInfo) -> Local + 'static,
{
let mut out = MaybeUninit::uninit();
let data = Box::into_raw(Box::new(callback));
Expand Down Expand Up @@ -59,7 +59,7 @@ where

unsafe extern "C" fn call_boxed<F>(env: Env, info: napi::CallbackInfo) -> Local
where
F: Fn(Env, napi::CallbackInfo) -> Local + Send + 'static,
F: Fn(Env, napi::CallbackInfo) -> Local + 'static,
{
let mut data = MaybeUninit::uninit();
let status = napi::get_cb_info(
Expand Down
2 changes: 1 addition & 1 deletion src/context/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -721,7 +721,7 @@ impl<'a> ModuleContext<'a> {
/// Convenience method for exporting a Neon function from a module.
pub fn export_function<F, V>(&mut self, key: &str, f: F) -> NeonResult<()>
where
F: Fn(FunctionContext) -> JsResult<V> + Send + 'static,
F: Fn(FunctionContext) -> JsResult<V> + 'static,
V: Value,
{
let value = JsFunction::new(self, f)?.upcast::<JsValue>();
Expand Down
4 changes: 2 additions & 2 deletions src/types/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -746,7 +746,7 @@ impl JsFunction {
pub fn new<'a, C, F, V>(cx: &mut C, f: F) -> JsResult<'a, JsFunction>
where
C: Context<'a>,
F: Fn(FunctionContext) -> JsResult<V> + Send + 'static,
F: Fn(FunctionContext) -> JsResult<V> + 'static,
V: Value,
{
Self::new_internal(cx, f)
Expand All @@ -756,7 +756,7 @@ impl JsFunction {
fn new_internal<'a, C, F, V>(cx: &mut C, f: F) -> JsResult<'a, JsFunction>
where
C: Context<'a>,
F: Fn(FunctionContext) -> JsResult<V> + Send + 'static,
F: Fn(FunctionContext) -> JsResult<V> + 'static,
V: Value,
{
use std::any;
Expand Down

0 comments on commit be6a7ed

Please sign in to comment.