From b32a6f8ad20e6e4b0cc24b8256c08192b4899844 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bartek=20Iwa=C5=84czuk?= Date: Tue, 7 Mar 2023 17:37:37 -0400 Subject: refactor(core): don't use Result in ExtensionBuilder::state (#18066) There's no point for this API to expect result. If something fails it should result in a panic during build time to signal to embedder that setup is wrong. --- runtime/ops/os/mod.rs | 1 - runtime/ops/runtime.rs | 1 - runtime/ops/worker_host.rs | 2 -- runtime/web_worker.rs | 1 - runtime/worker.rs | 1 - 5 files changed, 6 deletions(-) (limited to 'runtime') diff --git a/runtime/ops/os/mod.rs b/runtime/ops/os/mod.rs index ac8ec541d..83ad8164f 100644 --- a/runtime/ops/os/mod.rs +++ b/runtime/ops/os/mod.rs @@ -45,7 +45,6 @@ pub fn init(exit_code: ExitCode) -> Extension { init_ops(&mut builder) .state(move |state| { state.put::(exit_code.clone()); - Ok(()) }) .build() } diff --git a/runtime/ops/runtime.rs b/runtime/ops/runtime.rs index 22a481e77..5ce9966e0 100644 --- a/runtime/ops/runtime.rs +++ b/runtime/ops/runtime.rs @@ -12,7 +12,6 @@ pub fn init(main_module: ModuleSpecifier) -> Extension { .ops(vec![op_main_module::decl()]) .state(move |state| { state.put::(main_module.clone()); - Ok(()) }) .build() } diff --git a/runtime/ops/worker_host.rs b/runtime/ops/worker_host.rs index 71009be8f..6007a3260 100644 --- a/runtime/ops/worker_host.rs +++ b/runtime/ops/worker_host.rs @@ -111,8 +111,6 @@ pub fn init( let format_js_error_fn_holder = FormatJsErrorFnHolder(format_js_error_fn.clone()); state.put::(format_js_error_fn_holder); - - Ok(()) }) .ops(vec![ op_create_worker::decl(), diff --git a/runtime/web_worker.rs b/runtime/web_worker.rs index cce69fabb..f07ecd27f 100644 --- a/runtime/web_worker.rs +++ b/runtime/web_worker.rs @@ -376,7 +376,6 @@ impl WebWorker { state.put::(permissions.clone()); state.put(ops::UnstableChecker { unstable }); state.put(ops::TestingFeaturesEnabled(enable_testing_features)); - Ok(()) }) .build(); let create_cache = options.cache_storage_dir.map(|storage_dir| { diff --git a/runtime/worker.rs b/runtime/worker.rs index 1a6b6f2fc..c10f9f36e 100644 --- a/runtime/worker.rs +++ b/runtime/worker.rs @@ -206,7 +206,6 @@ impl MainWorker { state.put::(permissions.clone()); state.put(ops::UnstableChecker { unstable }); state.put(ops::TestingFeaturesEnabled(enable_testing_features)); - Ok(()) }) .build(); let exit_code = ExitCode(Arc::new(AtomicI32::new(0))); -- cgit v1.2.3