From cd1b196de436192cc3da6b5fc2ca37ca70fa5254 Mon Sep 17 00:00:00 2001 From: gterzian <2792687+gterzian@users.noreply.github.com> Date: Thu, 5 Jun 2025 17:09:18 +0700 Subject: [PATCH] fix clippy Signed-off-by: gterzian <2792687+gterzian@users.noreply.github.com> --- components/script/dom/promise.rs | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/components/script/dom/promise.rs b/components/script/dom/promise.rs index dca5a91b463..ac5615474aa 100644 --- a/components/script/dom/promise.rs +++ b/components/script/dom/promise.rs @@ -407,6 +407,11 @@ impl FromJSValConvertibleRc for Promise { } } +/// The success steps of +type WaitForAllSuccessSteps = Rc)>; + +/// The failure steps of +type WaitForAllFailureSteps = Rc; /// The fulfillment handler for the list of promises in /// . @@ -416,7 +421,7 @@ struct WaitForAllFulfillmentHandler { /// The steps to call when all promises are resolved. #[ignore_malloc_size_of = "Rc is hard"] #[no_trace] - success_steps: Rc)>, + success_steps: WaitForAllSuccessSteps, /// The results of the promises. #[ignore_malloc_size_of = "Rc is hard"] @@ -442,7 +447,7 @@ impl Callback for WaitForAllFulfillmentHandler { // Set fullfilledCount to fullfilledCount + 1. let mut fulfilled_count = self.fulfilled_count.borrow_mut(); - *fulfilled_count = *fulfilled_count + 1; + *fulfilled_count += 1; *fulfilled_count == result.len() }; @@ -471,7 +476,7 @@ struct WaitForAllRejectionHandler { /// The steps to call if any promise rejects. #[ignore_malloc_size_of = "Rc is hard"] #[no_trace] - failure_steps: Rc, + failure_steps: WaitForAllFailureSteps, /// Whether any promises have been rejected already. rejected: Cell, @@ -497,8 +502,8 @@ pub(crate) fn wait_for_all( cx: SafeJSContext, global: &GlobalScope, promises: Vec>, - success_steps: Rc)>, - failure_steps: Rc, + success_steps: WaitForAllSuccessSteps, + failure_steps: WaitForAllFailureSteps, realm: InRealm, can_gc: CanGc, ) {