@@ -558,22 +558,31 @@ impl<L: Language, D: ParsedSource<Language = L>> Graph<D> {
558558 idx : usize ,
559559 project : & Project < C , T > ,
560560 f : & mut W ,
561+ ) -> std:: result:: Result < ( ) , std:: fmt:: Error > {
562+ self . format_node ( idx, project, f) ?;
563+ write ! ( f, " imports:" ) ?;
564+ for dep in self . node_ids ( idx) . skip ( 1 ) {
565+ write ! ( f, "\n " ) ?;
566+ self . format_node ( dep, project, f) ?;
567+ }
568+
569+ Ok ( ( ) )
570+ }
571+
572+ /// Formats a single node along with its version requirements.
573+ fn format_node < W : std:: fmt:: Write , C : Compiler < Language = L > , T : ArtifactOutput > (
574+ & self ,
575+ idx : usize ,
576+ project : & Project < C , T > ,
577+ f : & mut W ,
561578 ) -> std:: result:: Result < ( ) , std:: fmt:: Error > {
562579 let node = self . node ( idx) ;
563- write ! ( f, "{} " , utils:: source_name( & node. path, & self . root) . display( ) ) ?;
580+ write ! ( f, "{}" , utils:: source_name( & node. path, & self . root) . display( ) ) ?;
564581 if let Some ( req) = node. data . version_req ( ) {
565- write ! ( f, "{req}" ) ?;
582+ write ! ( f, " {req}" ) ?;
566583 }
567584 if let Some ( req) = project. restrictions . get ( & node. path ) . and_then ( |r| r. version . as_ref ( ) ) {
568- write ! ( f, "{req}" ) ?;
569- }
570- write ! ( f, " imports:" ) ?;
571- for dep in self . node_ids ( idx) . skip ( 1 ) {
572- let dep = self . node ( dep) ;
573- write ! ( f, "\n {} " , utils:: source_name( & dep. path, & self . root) . display( ) ) ?;
574- if let Some ( req) = dep. data . version_req ( ) {
575- write ! ( f, "{req}" ) ?;
576- }
585+ write ! ( f, " {req}" ) ?;
577586 }
578587
579588 Ok ( ( ) )
0 commit comments