From c4e171e2d67be8c3e568c67146472fe358376bd8 Mon Sep 17 00:00:00 2001 From: Niklas Mischkulnig <4586894+mischnic@users.noreply.github.com> Date: Tue, 30 Jul 2024 11:56:15 +0200 Subject: [PATCH] Cleanup --- .../turbopack-core/src/resolve/alias_map.rs | 6 ++-- crates/turbopack-core/src/resolve/mod.rs | 3 -- crates/turbopack-core/src/resolve/options.rs | 2 -- crates/turbopack-core/src/resolve/remap.rs | 31 ------------------- 4 files changed, 2 insertions(+), 40 deletions(-) diff --git a/crates/turbopack-core/src/resolve/alias_map.rs b/crates/turbopack-core/src/resolve/alias_map.rs index 44a87ff07e0dc1..26ce7b4b81c2a8 100644 --- a/crates/turbopack-core/src/resolve/alias_map.rs +++ b/crates/turbopack-core/src/resolve/alias_map.rs @@ -599,8 +599,6 @@ where } /// Returns the wrapped value. - /// - /// Only implemented when `T::Output` is `T`. pub fn as_self(&'a self) -> &T::Output<'a> { match self { Self::Exact(v) => v, @@ -617,7 +615,7 @@ where /// /// Consumes the match. /// - /// Only implemented when `T::Output` is `Result`. + /// Only implemented when `T::Output` is some `Result<_, _>`. pub fn try_into_self(self) -> Result { Ok(match self { Self::Exact(v) => v?, @@ -635,7 +633,7 @@ where /// /// Consumes the match. /// - /// Only implemented when `T::Output` is `impl Future>` + /// Only implemented when `T::Output` is some `impl Future>` pub async fn try_join_into_self(self) -> Result { Ok(match self { Self::Exact(v) => v.await?, diff --git a/crates/turbopack-core/src/resolve/mod.rs b/crates/turbopack-core/src/resolve/mod.rs index 23de0da019a44c..9421955ddece2b 100644 --- a/crates/turbopack-core/src/resolve/mod.rs +++ b/crates/turbopack-core/src/resolve/mod.rs @@ -2579,15 +2579,12 @@ async fn handle_exports_imports_field( .collect::>>()?; for value in values.iter() { - // println!("handle_exports_imports_field {:?}", value); - if value.add_results( conditions, unspecified_conditions, &mut conditions_state, &mut results, ) { - // println!("handle_exports_imports_field break"); break; } } diff --git a/crates/turbopack-core/src/resolve/options.rs b/crates/turbopack-core/src/resolve/options.rs index 805a14b0248729..aa989ce6a5f037 100644 --- a/crates/turbopack-core/src/resolve/options.rs +++ b/crates/turbopack-core/src/resolve/options.rs @@ -144,7 +144,6 @@ impl AliasTemplate for Vc { Box::pin(async move { let this = &*self.await?; Ok(match this { - // _ => ImportMapping::Ignore ImportMapping::External(name, ty) => { ReplacedImportMapping::External(name.clone(), *ty) } @@ -172,7 +171,6 @@ impl AliasTemplate for Vc { Box::pin(async move { let this = &*self.await?; Ok(match this { - // _ => ImportMapping::Ignore ImportMapping::External(name, ty) => { if let Some(name) = name { ReplacedImportMapping::External( diff --git a/crates/turbopack-core/src/resolve/remap.rs b/crates/turbopack-core/src/resolve/remap.rs index 37e4650207bde7..95fd5662e5ce5a 100644 --- a/crates/turbopack-core/src/resolve/remap.rs +++ b/crates/turbopack-core/src/resolve/remap.rs @@ -330,37 +330,6 @@ impl SubpathValueResult { SubpathValueResult::Excluded => true, } } - - // fn try_new(value: &Value, ty: ExportImport) -> Result { - // match value { - // Value::Null => Ok(SubpathValue::Excluded), - // Value::String(s) => Ok(SubpathValue::Result(s.as_str().into())), - // Value::Number(_) => bail!("numeric values are invalid in {ty}s field - // entries"), Value::Bool(_) => bail!("boolean values are invalid in - // {ty}s field entries"), Value::Object(object) => - // Ok(SubpathValue::Conditional( object - // .iter() - // .map(|(key, value)| { - // if key.starts_with('.') { - // bail!( - // "invalid key \"{}\" in an {ty} field conditions - // object. Did you \ mean to place this request - // at a higher level?", key - // ); - // } - - // Ok((key.as_str().into(), SubpathValue::try_new(value, - // ty)?)) }) - // .collect::>>()?, - // )), - // Value::Array(array) => Ok(SubpathValue::Alternatives( - // array - // .iter() - // .map(|value| SubpathValue::try_new(value, ty)) - // .collect::>>()?, - // )), - // } - // } } struct ResultsIterMut<'a> {