diff --git a/turbopack/crates/turbo-tasks/src/primitives.rs b/turbopack/crates/turbo-tasks/src/primitives.rs index 174398548ae83..a49fbeb5fa369 100644 --- a/turbopack/crates/turbo-tasks/src/primitives.rs +++ b/turbopack/crates/turbo-tasks/src/primitives.rs @@ -1,62 +1,19 @@ -use std::{future::IntoFuture, ops::Deref, time::Duration}; +use std::{ops::Deref, time::Duration}; -use anyhow::Result; -use futures::TryFutureExt; // This specific macro identifier is detected by turbo-tasks-build. use turbo_tasks_macros::primitive as __turbo_tasks_internal_primitive; use crate::{ - RcStr, TryJoinIterExt, Vc, {self as turbo_tasks}, + RcStr, Vc, {self as turbo_tasks}, }; __turbo_tasks_internal_primitive!(()); __turbo_tasks_internal_primitive!(String); __turbo_tasks_internal_primitive!(RcStr); - -#[turbo_tasks::function] -fn empty_string() -> Vc { - Vc::cell(RcStr::default()) -} - -impl Vc { - #[deprecated(note = "use Default::default() instead")] - #[inline(always)] - pub fn empty() -> Vc { - empty_string() - } -} - __turbo_tasks_internal_primitive!(Option); __turbo_tasks_internal_primitive!(Option); __turbo_tasks_internal_primitive!(Vec); - -#[turbo_tasks::function] -fn empty_string_vec() -> Vc> { - Vc::cell(Vec::new()) -} - -impl Vc> { - #[deprecated(note = "use Default::default() instead")] - #[inline(always)] - pub fn empty() -> Vc> { - empty_string_vec() - } -} - __turbo_tasks_internal_primitive!(Option); - -#[turbo_tasks::function] -fn option_string_none() -> Vc> { - Vc::cell(None) -} - -impl Vc> { - #[deprecated(note = "use Default::default() instead")] - pub fn none() -> Self { - option_string_none() - } -} - __turbo_tasks_internal_primitive!(bool); __turbo_tasks_internal_primitive!(u8); __turbo_tasks_internal_primitive!(u16); @@ -73,46 +30,8 @@ __turbo_tasks_internal_primitive!(isize); __turbo_tasks_internal_primitive!(serde_json::Value); __turbo_tasks_internal_primitive!(Duration); __turbo_tasks_internal_primitive!(Vec); - __turbo_tasks_internal_primitive!(Vec); -#[turbo_tasks::value(transparent)] -pub struct Bools(Vec>); - -#[turbo_tasks::value_impl] -impl Bools { - #[turbo_tasks::function] - pub fn empty() -> Vc { - Vc::cell(Vec::new()) - } - - #[turbo_tasks::function] - async fn into_bools(&self) -> Result>> { - let bools = self - .0 - .iter() - .map(|b| b.into_future().map_ok(|b| *b)) - .try_join() - .await?; - - Ok(Vc::cell(bools)) - } - - #[turbo_tasks::function] - pub async fn all(self: Vc) -> Result> { - let bools = self.into_bools().await?; - - Ok(Vc::cell(bools.iter().all(|b| *b))) - } - - #[turbo_tasks::function] - pub async fn any(self: Vc) -> Result> { - let bools = self.into_bools().await?; - - Ok(Vc::cell(bools.iter().any(|b| *b))) - } -} - #[turbo_tasks::value(transparent, eq = "manual")] #[derive(Debug, Clone)] pub struct Regex(