@@ -623,103 +623,6 @@ impl CrateCache {
623623 . await
624624 }
625625
626- /// Detect and handle workspace crates
627- async fn detect_and_handle_workspace (
628- & self ,
629- crate_name : & str ,
630- version : & str ,
631- source_path : & std:: path:: Path ,
632- source : & CrateSource ,
633- source_str : Option < & str > ,
634- updated : bool ,
635- ) -> Result < CacheResponse > {
636- let cargo_toml_path = source_path. join ( "Cargo.toml" ) ;
637-
638- tracing:: info!(
639- "detect_and_handle_workspace: checking {}" ,
640- cargo_toml_path. display( )
641- ) ;
642-
643- // Read and log the content to debug workspace detection
644- if let Ok ( content) = std:: fs:: read_to_string ( & cargo_toml_path) {
645- tracing:: info!(
646- "detect_and_handle_workspace: Cargo.toml content preview for {}: {}" ,
647- crate_name,
648- & content[ 0 ..content. len( ) . min( 500 ) ]
649- ) ;
650- }
651-
652- match WorkspaceHandler :: is_workspace ( & cargo_toml_path) {
653- Ok ( true ) => {
654- tracing:: info!( "detect_and_handle_workspace: {} is a workspace" , crate_name) ;
655- // It's a workspace, get the members
656- let members = WorkspaceHandler :: get_workspace_members ( & cargo_toml_path)
657- . context ( "Failed to get workspace members" ) ?;
658- Ok ( self . generate_workspace_response ( crate_name, version, members, source, updated) )
659- }
660- Ok ( false ) => {
661- tracing:: info!(
662- "detect_and_handle_workspace: {} is NOT a workspace" ,
663- crate_name
664- ) ;
665- // Not a workspace, proceed with normal caching
666- self . cache_regular_crate ( crate_name, version, source_str)
667- . await
668- }
669- Err ( e) => {
670- tracing:: warn!(
671- "detect_and_handle_workspace: error checking workspace status for {}: {}" ,
672- crate_name,
673- e
674- ) ;
675- // Error checking workspace status - try to determine if it's likely a workspace
676- // by checking for common workspace indicators to avoid attempting doc generation
677- // on workspace roots
678- let cargo_content = match std:: fs:: read_to_string ( & cargo_toml_path) {
679- Ok ( content) => content,
680- Err ( _) => {
681- // Can't read Cargo.toml, fall back to normal caching
682- return self
683- . cache_regular_crate ( crate_name, version, source_str)
684- . await ;
685- }
686- } ;
687-
688- // Check for workspace indicators even if parsing failed
689- if cargo_content. contains ( "[workspace]" ) && cargo_content. contains ( "members" ) {
690- tracing:: warn!(
691- "detect_and_handle_workspace: {} appears to be a workspace based on content analysis, \
692- but parsing failed. Treating as workspace to avoid doc generation errors",
693- crate_name
694- ) ;
695-
696- // Return a generic workspace response indicating we couldn't parse the members
697- let error_msg = format ! (
698- "Detected workspace but failed to parse members: {e}. \
699- Please check the Cargo.toml syntax or cache specific members manually."
700- ) ;
701- Ok ( CacheResponse :: error ( error_msg) )
702- } else {
703- // Doesn't look like a workspace, try normal caching
704- self . cache_regular_crate ( crate_name, version, source_str)
705- . await
706- }
707- }
708- }
709- }
710-
711- /// Cache a regular (non-workspace) crate
712- async fn cache_regular_crate (
713- & self ,
714- crate_name : & str ,
715- version : & str ,
716- source_str : Option < & str > ,
717- ) -> Result < CacheResponse > {
718- self . ensure_crate_docs ( crate_name, version, source_str)
719- . await ?;
720- Ok ( CacheResponse :: success ( crate_name, version) )
721- }
722-
723626 /// Resolve version for local paths
724627 async fn resolve_local_path_version (
725628 & self ,
0 commit comments