summaryrefslogtreecommitdiff
path: root/core
diff options
context:
space:
mode:
authorLeo K <crowlkats@toaxl.com>2021-10-05 22:38:27 +0200
committerGitHub <noreply@github.com>2021-10-05 22:38:27 +0200
commit77a00ce1fb4ae2523e22b9b84ae09a0200502e38 (patch)
tree0027a2ff3dbff1e2b0c3afa7ce0f0e54805c7d62 /core
parentd67e85850688117e116bbf7054e80f30fe07afe6 (diff)
chore: various op cleanup (#12329)
Diffstat (limited to 'core')
-rw-r--r--core/error.rs4
-rw-r--r--core/examples/http_bench_json_ops.rs9
-rw-r--r--core/ops_builtin.rs2
-rw-r--r--core/runtime.rs6
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"))
}