From e694c074e688ebe3670604ad67096f361a13558a Mon Sep 17 00:00:00 2001 From: afinch7 Date: Thu, 27 Aug 2020 17:35:57 -0400 Subject: [PATCH] fmt --- core/plugin_api.rs | 5 ++--- test_plugin/src/lib.rs | 24 +++++++++++------------- test_plugin/tests/test.js | 4 +++- 3 files changed, 16 insertions(+), 17 deletions(-) diff --git a/core/plugin_api.rs b/core/plugin_api.rs index c37e3d61070a46..57d79a03d5f491 100644 --- a/core/plugin_api.rs +++ b/core/plugin_api.rs @@ -15,8 +15,7 @@ pub use crate::ZeroCopyBuf; pub type InitFn = fn(&mut dyn Interface); -pub type DispatchOpFn = - dyn Fn(&mut dyn Interface, &mut [ZeroCopyBuf]) -> Op; +pub type DispatchOpFn = dyn Fn(&mut dyn Interface, &mut [ZeroCopyBuf]) -> Op; pub trait Interface { fn register_op(&mut self, name: &str, dispatcher: Box) -> OpId; -} \ No newline at end of file +} diff --git a/test_plugin/src/lib.rs b/test_plugin/src/lib.rs index d79e5d032ed8ca..661399ef3626fc 100644 --- a/test_plugin/src/lib.rs +++ b/test_plugin/src/lib.rs @@ -1,11 +1,11 @@ use deno_core::plugin_api::Buf; +use deno_core::plugin_api::DispatchOpFn; use deno_core::plugin_api::Interface; use deno_core::plugin_api::Op; use deno_core::plugin_api::ZeroCopyBuf; -use deno_core::plugin_api::DispatchOpFn; use futures::future::FutureExt; -#[no_mangle] +#[no_mangle] pub fn deno_plugin_init(interface: &mut dyn Interface) { interface.register_op("testSync", Box::new(op_test_sync)); interface.register_op("testAsync", Box::new(op_test_async)); @@ -56,18 +56,16 @@ fn op_test_async( Op::Async(fut.boxed()) } -fn wrap_op(d: D) -> Box -where - D: Fn( - &mut dyn Interface, - String, - &mut [ZeroCopyBuf], - ) -> Op + 'static +fn wrap_op(d: D) -> Box +where + D: Fn(&mut dyn Interface, String, &mut [ZeroCopyBuf]) -> Op + 'static, { - Box::new(move |i: &mut dyn Interface, zero_copy: &mut [ZeroCopyBuf]| { - let first_buf_str = std::str::from_utf8(&zero_copy[0][..]).unwrap(); - d(i, first_buf_str.to_string(), &mut zero_copy[1..]) - }) + Box::new( + move |i: &mut dyn Interface, zero_copy: &mut [ZeroCopyBuf]| { + let first_buf_str = std::str::from_utf8(&zero_copy[0][..]).unwrap(); + d(i, first_buf_str.to_string(), &mut zero_copy[1..]) + }, + ) } fn op_wrapped( diff --git a/test_plugin/tests/test.js b/test_plugin/tests/test.js index 9cabf535e3b0ec..bd88683fe44ebd 100644 --- a/test_plugin/tests/test.js +++ b/test_plugin/tests/test.js @@ -37,7 +37,9 @@ const promiseTestAsync = new Promise((resolve) => resolveTestAsync = resolve); let resolveTestWrapped; -const promiseTestWrapped = new Promise((resolve) => resolveTestWrapped = resolve); +const promiseTestWrapped = new Promise((resolve) => + resolveTestWrapped = resolve +); function runTestSync() { const response = Deno.core.dispatch(