Repository: vercel/next.js
Pull request: Turbopack: Remove some dead (or useless) code from `next-core/src/next_client_reference/visit_client_reference.rs`

![](https://media1.giphy.com/media/v1.Y2lkPWM5NDg3NzQzNW5iazVteTUxejQzYnNnbjhvNjY4eGxpZDBsMmRmMDF5aHg3eWs0NSZlcD12MV9naWZzX3NlYXJjaCZjdD1n/qH7J4EXzSCmBy/giphy.gif)

Changed files:
filename: crates/next-core/src/next_app/app_client_references_chunks.rs
patch: @@ -50,10 +50,9 @@ pub async fn get_app_client_references_chunks(
             //     .client_references
             //     .iter()
             //     .map(|client_reference| async move {
-            //         let client_reference_ty = client_reference.ty();
             //         Ok((
-            //             client_reference_ty,
-            //             match client_reference_ty {
+            //             client_reference.ty,
+            //             match client_reference.ty {
             //                 ClientReferenceType::EcmascriptClientReference(
             //                     ecmascript_client_reference,
             //                 ) => {
@@ -141,13 +140,13 @@ pub async fn get_app_client_references_chunks(
                     .or_default();
             }
             for client_reference in app_client_references.client_references.iter() {
-                if let Some(server_component) = client_reference.server_component() {
+                if let Some(server_component) = client_reference.server_component {
                     client_references_by_server_component
                         .entry(server_component)
                         .or_default()
-                        .push(client_reference.ty());
+                        .push(client_reference.ty);
                 } else {
-                    framework_reference_types.push(client_reference.ty());
+                    framework_reference_types.push(client_reference.ty);
                 }
             }
             // Framework components need to go into first layout segment

filename: crates/next-core/src/next_client_reference/mod.rs
patch: @@ -11,6 +11,6 @@ pub use ecmascript_client_reference::{
     ecmascript_client_reference_transition::NextEcmascriptClientReferenceTransition,
 };
 pub use visit_client_reference::{
-    ClientReference, ClientReferenceGraphResult, ClientReferenceType, ClientReferenceTypes,
-    ServerEntries, VisitedClientReferenceGraphNodes, find_server_entries,
+    ClientReference, ClientReferenceGraphResult, ClientReferenceType, ServerEntries,
+    find_server_entries,
 };

filename: crates/next-core/src/next_client_reference/visit_client_reference.rs
patch: @@ -1,12 +1,11 @@
 use std::future::Future;
 
 use anyhow::Result;
-use rustc_hash::FxHashSet;
 use serde::{Deserialize, Serialize};
 use tracing::{Instrument, Level, Span};
 use turbo_rcstr::RcStr;
 use turbo_tasks::{
-    FxIndexSet, NonLocalValue, ReadRef, ResolvedVc, TryJoinIterExt, Vc,
+    NonLocalValue, ReadRef, ResolvedVc, TryJoinIterExt, Vc,
     debug::ValueDebugFormat,
     graph::{AdjacencyMap, GraphTraversal, Visit, VisitControlFlow},
     trace::TraceRawVcs,
@@ -43,19 +42,6 @@ pub struct ClientReference {
     pub ty: ClientReferenceType,
 }
 
-impl ClientReference {
-    pub fn server_component(&self) -> Option<ResolvedVc<NextServerComponentModule>> {
-        self.server_component
-    }
-
-    pub fn ty(&self) -> ClientReferenceType {
-        self.ty
-    }
-}
-
-#[turbo_tasks::value(transparent)]
-pub struct ClientReferences(Vec<ClientReference>);
-
 #[derive(
     Copy,
     Clone,
@@ -82,33 +68,6 @@ pub struct ClientReferenceGraphResult {
     pub server_utils: Vec<ResolvedVc<NextServerUtilityModule>>,
 }
 
-#[turbo_tasks::value(shared)]
-pub struct VisitedClientReferenceGraphNodes(FxHashSet<FindServerEntriesNode>);
-
-#[turbo_tasks::value_impl]
-impl VisitedClientReferenceGraphNodes {
-    #[turbo_tasks::function]
-    pub fn empty() -> Vc<Self> {
-        VisitedClientReferenceGraphNodes(Default::default()).cell()
-    }
-}
-
-#[turbo_tasks::value(transparent)]
-pub struct ClientReferenceTypes(FxIndexSet<ClientReferenceType>);
-
-#[turbo_tasks::value_impl]
-impl ClientReferenceGraphResult {
-    #[turbo_tasks::function]
-    pub fn types(&self) -> Vc<ClientReferenceTypes> {
-        Vc::cell(
-            self.client_references
-                .iter()
-                .map(|r| r.ty())
-                .collect::<FxIndexSet<_>>(),
-        )
-    }
-}
-
 #[turbo_tasks::value(shared)]
 #[derive(Clone, Debug)]
 pub struct ServerEntries {

filename: crates/next-core/src/next_manifests/client_reference_manifest.rs
patch: @@ -185,7 +185,7 @@ async fn build_manifest(
             .client_references
             .iter()
             .map(async |r| {
-                Ok(match r.ty() {
+                Ok(match r.ty {
                     ClientReferenceType::EcmascriptClientReference(r) => Some((r, r.await?)),
                     ClientReferenceType::CssClientReference(_) => None,
                 })