From 88d0f01948b68f4a4d87e02a5138e94ac0a6eaea Mon Sep 17 00:00:00 2001 From: Aaron O'Mullan Date: Mon, 14 Mar 2022 23:38:53 +0100 Subject: feat(ops): custom arity (#13949) Also cleanup & drop ignored wildcard op-args --- ext/web/blob.rs | 5 ----- ext/web/compression.rs | 1 - ext/web/lib.rs | 11 +---------- ext/web/message_port.rs | 3 --- ext/web/timers.rs | 13 ++----------- 5 files changed, 3 insertions(+), 30 deletions(-) (limited to 'ext/web') diff --git a/ext/web/blob.rs b/ext/web/blob.rs index ad7f6c582..43121ee3a 100644 --- a/ext/web/blob.rs +++ b/ext/web/blob.rs @@ -163,7 +163,6 @@ impl BlobPart for SlicedBlobPart { pub fn op_blob_create_part( state: &mut deno_core::OpState, data: ZeroCopyBuf, - _: (), ) -> Result { let blob_store = state.borrow::(); let part = InMemoryBlobPart(data.to_vec()); @@ -208,7 +207,6 @@ pub fn op_blob_slice_part( pub async fn op_blob_read_part( state: Rc>, id: Uuid, - _: (), ) -> Result { let part = { let state = state.borrow(); @@ -224,7 +222,6 @@ pub async fn op_blob_read_part( pub fn op_blob_remove_part( state: &mut deno_core::OpState, id: Uuid, - _: (), ) -> Result<(), AnyError> { let blob_store = state.borrow::(); blob_store.remove_part(&id); @@ -261,7 +258,6 @@ pub fn op_blob_create_object_url( pub fn op_blob_revoke_object_url( state: &mut deno_core::OpState, url: String, - _: (), ) -> Result<(), AnyError> { let url = Url::parse(&url)?; let blob_store = state.borrow::(); @@ -285,7 +281,6 @@ pub struct ReturnBlobPart { pub fn op_blob_from_object_url( state: &mut deno_core::OpState, url: String, - _: (), ) -> Result, AnyError> { let url = Url::parse(&url)?; if url.scheme() != "blob" { diff --git a/ext/web/compression.rs b/ext/web/compression.rs index d38f65d6a..f5ee38257 100644 --- a/ext/web/compression.rs +++ b/ext/web/compression.rs @@ -93,7 +93,6 @@ pub fn op_compression_write( pub fn op_compression_finish( state: &mut OpState, rid: ResourceId, - _: (), ) -> Result { let resource = state.resource_table.take::(rid)?; let resource = Rc::try_unwrap(resource).unwrap(); diff --git a/ext/web/lib.rs b/ext/web/lib.rs index 6c278cbb0..17133e156 100644 --- a/ext/web/lib.rs +++ b/ext/web/lib.rs @@ -123,7 +123,6 @@ pub fn init( fn op_base64_decode( _: &mut OpState, input: String, - _: (), ) -> Result { let mut input = input.into_bytes(); input.retain(|c| !c.is_ascii_whitespace()); @@ -134,7 +133,6 @@ fn op_base64_decode( fn op_base64_atob( _: &mut OpState, s: ByteString, - _: (), ) -> Result { let mut s = s.0; s.retain(|c| !c.is_ascii_whitespace()); @@ -188,17 +186,12 @@ fn b64_decode(input: &[u8]) -> Result, AnyError> { fn op_base64_encode( _: &mut OpState, s: ZeroCopyBuf, - _: (), ) -> Result { Ok(b64_encode(&s)) } #[op] -fn op_base64_btoa( - _: &mut OpState, - s: ByteString, - _: (), -) -> Result { +fn op_base64_btoa(_: &mut OpState, s: ByteString) -> Result { Ok(b64_encode(&s)) } @@ -220,7 +213,6 @@ struct DecoderOptions { fn op_encoding_normalize_label( _state: &mut OpState, label: String, - _: (), ) -> Result { let encoding = Encoding::for_label_no_replacement(label.as_bytes()) .ok_or_else(|| { @@ -236,7 +228,6 @@ fn op_encoding_normalize_label( fn op_encoding_new_decoder( state: &mut OpState, options: DecoderOptions, - _: (), ) -> Result { let DecoderOptions { label, diff --git a/ext/web/message_port.rs b/ext/web/message_port.rs index 7f2b18b3c..b193e6b9b 100644 --- a/ext/web/message_port.rs +++ b/ext/web/message_port.rs @@ -109,8 +109,6 @@ impl Resource for MessagePortResource { #[op] pub fn op_message_port_create_entangled( state: &mut OpState, - _: (), - _: (), ) -> Result<(ResourceId, ResourceId), AnyError> { let (port1, port2) = create_entangled_message_port(); @@ -211,7 +209,6 @@ pub fn op_message_port_post_message( pub async fn op_message_port_recv_message( state: Rc>, rid: ResourceId, - _: (), ) -> Result, AnyError> { let resource = { let state = state.borrow(); diff --git a/ext/web/timers.rs b/ext/web/timers.rs index 9a78240f7..670df3582 100644 --- a/ext/web/timers.rs +++ b/ext/web/timers.rs @@ -28,11 +28,7 @@ pub type StartTime = Instant; // If the High precision flag is not set, the // nanoseconds are rounded on 2ms. #[op] -pub fn op_now( - state: &mut OpState, - _argument: (), - _: (), -) -> Result +pub fn op_now(state: &mut OpState, _argument: ()) -> Result where TP: TimersPermission + 'static, { @@ -68,11 +64,7 @@ impl Resource for TimerHandle { /// Creates a [`TimerHandle`] resource that can be used to cancel invocations of /// [`op_sleep`]. #[op] -pub fn op_timer_handle( - state: &mut OpState, - _: (), - _: (), -) -> Result { +pub fn op_timer_handle(state: &mut OpState) -> Result { let rid = state .resource_table .add(TimerHandle(CancelHandle::new_rc())); @@ -98,7 +90,6 @@ pub async fn op_sleep( pub fn op_sleep_sync( state: &mut OpState, millis: u64, - _: (), ) -> Result<(), AnyError> where TP: TimersPermission + 'static, -- cgit v1.2.3