@@ -110,7 +110,10 @@ fn main() -> Result<(), Box<dyn std::error::Error>> {
110110 if apply {
111111 create_label ( & beads. repo , label) ?;
112112 } else {
113- println ! ( " + label {} ({}, {})" , label. name, label. color, label. description) ;
113+ println ! (
114+ " + label {} ({}, {})" ,
115+ label. name, label. color, label. description
116+ ) ;
114117 }
115118 }
116119
@@ -176,9 +179,15 @@ fn phase_string(v: &serde_yaml::Value) -> String {
176179}
177180
178181fn phase_to_epic_map ( ) -> BTreeMap < & ' static str , & ' static str > {
179- [ ( "0" , "E0" ) , ( "1" , "E1" ) , ( "2" , "E2" ) , ( "2b" , "E2" ) , ( "3" , "E3" ) ]
180- . into_iter ( )
181- . collect ( )
182+ [
183+ ( "0" , "E0" ) ,
184+ ( "1" , "E1" ) ,
185+ ( "2" , "E2" ) ,
186+ ( "2b" , "E2" ) ,
187+ ( "3" , "E3" ) ,
188+ ]
189+ . into_iter ( )
190+ . collect ( )
182191}
183192
184193fn phase_to_label_map ( ) -> BTreeMap < & ' static str , & ' static str > {
@@ -193,11 +202,7 @@ fn phase_to_label_map() -> BTreeMap<&'static str, &'static str> {
193202 . collect ( )
194203}
195204
196- fn bead_labels (
197- bead : & Bead ,
198- phase_str : & str ,
199- phase_to_label : & BTreeMap < & str , & str > ,
200- ) -> Vec < String > {
205+ fn bead_labels ( bead : & Bead , phase_str : & str , phase_to_label : & BTreeMap < & str , & str > ) -> Vec < String > {
201206 let mut labels = vec ! [ "bead" . to_string( ) ] ;
202207 if let Some ( p) = phase_to_label. get ( phase_str) {
203208 labels. push ( ( * p) . to_string ( ) ) ;
@@ -374,10 +379,8 @@ fn compose_parallel_plan(beads: &[Bead]) -> String {
374379 let parallel = max_parallel_groups ( group) ;
375380 for ( i, batch) in parallel. iter ( ) . enumerate ( ) {
376381 let ids: Vec < String > = batch. iter ( ) . map ( |b| b. id . clone ( ) ) . collect ( ) ;
377- let files: BTreeSet < String > = batch
378- . iter ( )
379- . flat_map ( |b| b. files . iter ( ) . cloned ( ) )
380- . collect ( ) ;
382+ let files: BTreeSet < String > =
383+ batch. iter ( ) . flat_map ( |b| b. files . iter ( ) . cloned ( ) ) . collect ( ) ;
381384 s. push_str ( & format ! (
382385 "- Batch {}.{}: {} (touches {})\n " ,
383386 d,
@@ -394,11 +397,7 @@ fn compose_parallel_plan(beads: &[Bead]) -> String {
394397fn compute_depths ( beads : & [ Bead ] ) -> BTreeMap < String , usize > {
395398 let by_id: BTreeMap < & str , & Bead > = beads. iter ( ) . map ( |b| ( b. id . as_str ( ) , b) ) . collect ( ) ;
396399 let mut depth = BTreeMap :: new ( ) ;
397- fn dfs (
398- id : & str ,
399- by_id : & BTreeMap < & str , & Bead > ,
400- depth : & mut BTreeMap < String , usize > ,
401- ) -> usize {
400+ fn dfs ( id : & str , by_id : & BTreeMap < & str , & Bead > , depth : & mut BTreeMap < String , usize > ) -> usize {
402401 if let Some ( d) = depth. get ( id) {
403402 return * d;
404403 }
@@ -453,15 +452,23 @@ fn escape_md(s: &str) -> String {
453452fn create_label ( repo : & str , label : & Label ) -> Result < ( ) , Box < dyn std:: error:: Error > > {
454453 let status = Command :: new ( "gh" )
455454 . args ( [
456- "label" , "create" , & label. name ,
457- "--repo" , repo,
458- "--color" , & label. color ,
459- "--description" , & label. description ,
455+ "label" ,
456+ "create" ,
457+ & label. name ,
458+ "--repo" ,
459+ repo,
460+ "--color" ,
461+ & label. color ,
462+ "--description" ,
463+ & label. description ,
460464 "--force" ,
461465 ] )
462466 . status ( ) ?;
463467 if !status. success ( ) {
464- eprintln ! ( "warning: label create failed for {} (may already exist)" , label. name) ;
468+ eprintln ! (
469+ "warning: label create failed for {} (may already exist)" ,
470+ label. name
471+ ) ;
465472 }
466473 Ok ( ( ) )
467474}
@@ -474,9 +481,23 @@ fn create_issue(
474481) -> Result < u64 , Box < dyn std:: error:: Error > > {
475482 // Dedup: skip if an open issue with the same title already exists.
476483 let existing = Command :: new ( "gh" )
477- . args ( [ "issue" , "list" , "--repo" , repo, "--state" , "all" , "--search" , title, "--json" , "number,title" , "--limit" , "20" ] )
484+ . args ( [
485+ "issue" ,
486+ "list" ,
487+ "--repo" ,
488+ repo,
489+ "--state" ,
490+ "all" ,
491+ "--search" ,
492+ title,
493+ "--json" ,
494+ "number,title" ,
495+ "--limit" ,
496+ "20" ,
497+ ] )
478498 . output ( ) ?;
479- let existing_json: serde_json:: Value = serde_json:: from_slice ( & existing. stdout ) . unwrap_or ( serde_json:: Value :: Array ( vec ! [ ] ) ) ;
499+ let existing_json: serde_json:: Value =
500+ serde_json:: from_slice ( & existing. stdout ) . unwrap_or ( serde_json:: Value :: Array ( vec ! [ ] ) ) ;
480501 if let Some ( arr) = existing_json. as_array ( ) {
481502 for v in arr {
482503 if v. get ( "title" ) . and_then ( |t| t. as_str ( ) ) == Some ( title) {
@@ -490,9 +511,12 @@ fn create_issue(
490511 let mut args = vec ! [
491512 "issue" . to_string( ) ,
492513 "create" . to_string( ) ,
493- "--repo" . to_string( ) , repo. to_string( ) ,
494- "--title" . to_string( ) , title. to_string( ) ,
495- "--body" . to_string( ) , body. to_string( ) ,
514+ "--repo" . to_string( ) ,
515+ repo. to_string( ) ,
516+ "--title" . to_string( ) ,
517+ title. to_string( ) ,
518+ "--body" . to_string( ) ,
519+ body. to_string( ) ,
496520 ] ;
497521 for l in labels {
498522 args. push ( "--label" . to_string ( ) ) ;
@@ -504,7 +528,11 @@ fn create_issue(
504528 return Err ( format ! ( "gh issue create failed: {}" , stderr) . into ( ) ) ;
505529 }
506530 let url = String :: from_utf8_lossy ( & output. stdout ) . trim ( ) . to_string ( ) ;
507- let number = url. rsplit ( '/' ) . next ( ) . and_then ( |s| s. parse ( ) . ok ( ) ) . unwrap_or ( 0 ) ;
531+ let number = url
532+ . rsplit ( '/' )
533+ . next ( )
534+ . and_then ( |s| s. parse ( ) . ok ( ) )
535+ . unwrap_or ( 0 ) ;
508536 println ! ( " + #{} {}" , number, title) ;
509537 Ok ( number)
510538}
0 commit comments