diff --git a/tests/plugin/lib.rs b/tests/plugin/lib.rs index 863de7cfd7dabc..a3521032e9b889 100644 --- a/tests/plugin/lib.rs +++ b/tests/plugin/lib.rs @@ -1,7 +1,7 @@ // Copyright 2018-2019 the Deno authors. All rights reserved. MIT license. -use deno::{PinnedBuf, Buf}; -use deno::plugins::{PluginOpResult, new_plugin_error}; +use deno::plugins::{new_plugin_error, PluginOpResult}; use deno::Op; +use deno::{Buf, PinnedBuf}; #[macro_use] extern crate deno; @@ -11,17 +11,20 @@ pub fn op_test_op( data: &[u8], zero_copy: Option, ) -> PluginOpResult { - if !is_sync { - return Err(new_plugin_error(String::from("Async not supported!"))); - } - if let Some(buf) = zero_copy { - let data_str = std::str::from_utf8(&data[..]).unwrap(); - let buf_str = std::str::from_utf8(&buf[..]).unwrap(); - println!("Hello from native bindings. data: {} | zero_copy: {}", data_str, buf_str); - } - let result = b"test"; - let result_box: Buf = Box::new(*result); - Ok(Op::Sync(result_box)) + if !is_sync { + return Err(new_plugin_error(String::from("Async not supported!"))); + } + if let Some(buf) = zero_copy { + let data_str = std::str::from_utf8(&data[..]).unwrap(); + let buf_str = std::str::from_utf8(&buf[..]).unwrap(); + println!( + "Hello from native bindings. data: {} | zero_copy: {}", + data_str, buf_str + ); + } + let result = b"test"; + let result_box: Buf = Box::new(*result); + Ok(Op::Sync(result_box)) } -declare_plugin_op!(test_op, op_test_op); \ No newline at end of file +declare_plugin_op!(test_op, op_test_op); diff --git a/tools/format.py b/tools/format.py index aa7586c5bee019..7f53ff5069bec1 100755 --- a/tools/format.py +++ b/tools/format.py @@ -46,4 +46,4 @@ def qrun(cmd, env=None): "third_party/rustfmt/" + platform() + "/rustfmt", "--config-path", rustfmt_config, -] + find_exts(["cli", "core", "tools"], [".rs"])) +] + find_exts(["cli", "core", "tools", "tests/plugin"], [".rs"]))