diff options
Diffstat (limited to 'core')
-rw-r--r-- | core/error.rs | 4 | ||||
-rw-r--r-- | core/examples/http_bench_json_ops.rs | 9 | ||||
-rw-r--r-- | core/ops_builtin.rs | 2 | ||||
-rw-r--r-- | core/runtime.rs | 6 |
4 files changed, 5 insertions, 16 deletions
diff --git a/core/error.rs b/core/error.rs index 087b27c41..be97a90fb 100644 --- a/core/error.rs +++ b/core/error.rs @@ -67,10 +67,6 @@ pub fn resource_unavailable() -> AnyError { ) } -pub fn null_opbuf() -> AnyError { - type_error("expected non-null op buffer arg") -} - /// A simple error type that lets the creator specify both the error message and /// the error class name. This type is private; externally it only ever appears /// wrapped in an `AnyError`. To retrieve the error class name from a wrapped diff --git a/core/examples/http_bench_json_ops.rs b/core/examples/http_bench_json_ops.rs index d273c2c88..5989a472f 100644 --- a/core/examples/http_bench_json_ops.rs +++ b/core/examples/http_bench_json_ops.rs @@ -1,5 +1,4 @@ // Copyright 2018-2021 the Deno authors. All rights reserved. MIT license. -use deno_core::error::null_opbuf; use deno_core::error::AnyError; use deno_core::AsyncRefCell; use deno_core::CancelHandle; @@ -121,7 +120,7 @@ fn create_js_runtime() -> JsRuntime { fn op_listen( state: &mut OpState, - _args: (), + _: (), _: (), ) -> Result<ResourceId, AnyError> { log::debug!("listen"); @@ -158,9 +157,8 @@ async fn op_accept( async fn op_read( state: Rc<RefCell<OpState>>, rid: ResourceId, - buf: Option<ZeroCopyBuf>, + mut buf: ZeroCopyBuf, ) -> Result<usize, AnyError> { - let mut buf = buf.ok_or_else(null_opbuf)?; log::debug!("read rid={}", rid); let stream = state.borrow().resource_table.get::<TcpStream>(rid)?; @@ -171,9 +169,8 @@ async fn op_read( async fn op_write( state: Rc<RefCell<OpState>>, rid: ResourceId, - buf: Option<ZeroCopyBuf>, + buf: ZeroCopyBuf, ) -> Result<usize, AnyError> { - let buf = buf.ok_or_else(null_opbuf)?; log::debug!("write rid={}", rid); let stream = state.borrow().resource_table.get::<TcpStream>(rid)?; diff --git a/core/ops_builtin.rs b/core/ops_builtin.rs index e1313fa32..392062960 100644 --- a/core/ops_builtin.rs +++ b/core/ops_builtin.rs @@ -34,7 +34,7 @@ pub(crate) fn init_builtins() -> Extension { /// and string representation as value. pub fn op_resources( state: &mut OpState, - _args: (), + _: (), _: (), ) -> Result<Vec<(ResourceId, String)>, AnyError> { let serialized_resources = state diff --git a/core/runtime.rs b/core/runtime.rs index 305052e9a..e4fe8cd6c 100644 --- a/core/runtime.rs +++ b/core/runtime.rs @@ -1919,11 +1919,7 @@ pub mod tests { #[test] fn test_error_builder() { - fn op_err( - _: &mut OpState, - _: (), - _: Option<ZeroCopyBuf>, - ) -> Result<(), AnyError> { + fn op_err(_: &mut OpState, _: (), _: ()) -> Result<(), AnyError> { Err(custom_error("DOMExceptionOperationError", "abc")) } |