diff options
author | Aaron O'Mullan <aaron.omullan@gmail.com> | 2022-03-14 23:38:53 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-03-14 23:38:53 +0100 |
commit | 88d0f01948b68f4a4d87e02a5138e94ac0a6eaea (patch) | |
tree | 2b50e5d2c6990c94f47e604281f3557b3efd9736 /cli/ops | |
parent | 9f494dc405afc4b1b29fa4c813bd5751f26aaa36 (diff) |
feat(ops): custom arity (#13949)
Also cleanup & drop ignored wildcard op-args
Diffstat (limited to 'cli/ops')
-rw-r--r-- | cli/ops/bench.rs | 11 | ||||
-rw-r--r-- | cli/ops/errors.rs | 3 | ||||
-rw-r--r-- | cli/ops/runtime_compiler.rs | 1 | ||||
-rw-r--r-- | cli/ops/testing.rs | 9 |
4 files changed, 3 insertions, 21 deletions
diff --git a/cli/ops/bench.rs b/cli/ops/bench.rs index ab15a2b4b..4b7d6743f 100644 --- a/cli/ops/bench.rs +++ b/cli/ops/bench.rs @@ -35,7 +35,6 @@ struct PermissionsHolder(Uuid, Permissions); pub fn op_pledge_test_permissions( state: &mut OpState, args: ChildPermissionsArg, - _: (), ) -> Result<Uuid, AnyError> { let token = Uuid::new_v4(); let parent_permissions = state.borrow_mut::<Permissions>(); @@ -54,7 +53,6 @@ pub fn op_pledge_test_permissions( pub fn op_restore_test_permissions( state: &mut OpState, token: Uuid, - _: (), ) -> Result<(), AnyError> { if let Some(permissions_holder) = state.try_take::<PermissionsHolder>() { if token != permissions_holder.0 { @@ -70,11 +68,7 @@ pub fn op_restore_test_permissions( } #[op] -fn op_get_bench_origin( - state: &mut OpState, - _: (), - _: (), -) -> Result<String, AnyError> { +fn op_get_bench_origin(state: &mut OpState) -> Result<String, AnyError> { Ok(state.borrow::<ModuleSpecifier>().to_string()) } @@ -82,7 +76,6 @@ fn op_get_bench_origin( fn op_dispatch_bench_event( state: &mut OpState, event: BenchEvent, - _: (), ) -> Result<(), AnyError> { let sender = state.borrow::<UnboundedSender<BenchEvent>>().clone(); sender.send(event).ok(); @@ -91,7 +84,7 @@ fn op_dispatch_bench_event( } #[op] -fn op_bench_now(state: &mut OpState, _: (), _: ()) -> Result<u64, AnyError> { +fn op_bench_now(state: &mut OpState) -> Result<u64, AnyError> { let ns = state.borrow::<time::Instant>().elapsed().as_nanos(); let ns_u64 = u64::try_from(ns)?; Ok(ns_u64) diff --git a/cli/ops/errors.rs b/cli/ops/errors.rs index c215ade41..5be6e0737 100644 --- a/cli/ops/errors.rs +++ b/cli/ops/errors.rs @@ -46,7 +46,6 @@ struct AppliedSourceMap { fn op_apply_source_map( state: &mut OpState, args: ApplySourceMap, - _: (), ) -> Result<AppliedSourceMap, AnyError> { let mut mappings_map: CachedMaps = HashMap::new(); let ps = state.borrow::<ProcState>().clone(); @@ -71,7 +70,6 @@ fn op_apply_source_map( fn op_format_diagnostic( _state: &mut OpState, args: Value, - _: (), ) -> Result<Value, AnyError> { let diagnostic: Diagnostics = serde_json::from_value(args)?; Ok(json!(diagnostic.to_string())) @@ -81,7 +79,6 @@ fn op_format_diagnostic( fn op_format_file_name( _state: &mut OpState, file_name: String, - _: (), ) -> Result<String, AnyError> { Ok(format_file_name(&file_name)) } diff --git a/cli/ops/runtime_compiler.rs b/cli/ops/runtime_compiler.rs index 6fb8d688c..8c02190c0 100644 --- a/cli/ops/runtime_compiler.rs +++ b/cli/ops/runtime_compiler.rs @@ -144,7 +144,6 @@ fn to_maybe_jsx_import_source_module( async fn op_emit( state: Rc<RefCell<OpState>>, args: EmitArgs, - _: (), ) -> Result<EmitResult, AnyError> { deno_runtime::ops::check_unstable2(&state, "Deno.emit"); let root_specifier = args.root_specifier; diff --git a/cli/ops/testing.rs b/cli/ops/testing.rs index ebaa819e1..eb2deb90c 100644 --- a/cli/ops/testing.rs +++ b/cli/ops/testing.rs @@ -33,7 +33,6 @@ struct PermissionsHolder(Uuid, Permissions); pub fn op_pledge_test_permissions( state: &mut OpState, args: ChildPermissionsArg, - _: (), ) -> Result<Uuid, AnyError> { let token = Uuid::new_v4(); let parent_permissions = state.borrow_mut::<Permissions>(); @@ -52,7 +51,6 @@ pub fn op_pledge_test_permissions( pub fn op_restore_test_permissions( state: &mut OpState, token: Uuid, - _: (), ) -> Result<(), AnyError> { if let Some(permissions_holder) = state.try_take::<PermissionsHolder>() { if token != permissions_holder.0 { @@ -68,11 +66,7 @@ pub fn op_restore_test_permissions( } #[op] -fn op_get_test_origin( - state: &mut OpState, - _: (), - _: (), -) -> Result<String, AnyError> { +fn op_get_test_origin(state: &mut OpState) -> Result<String, AnyError> { Ok(state.borrow::<ModuleSpecifier>().to_string()) } @@ -80,7 +74,6 @@ fn op_get_test_origin( fn op_dispatch_test_event( state: &mut OpState, event: TestEvent, - _: (), ) -> Result<(), AnyError> { let sender = state.borrow::<UnboundedSender<TestEvent>>().clone(); sender.send(event).ok(); |