@@ -549,12 +549,18 @@ impl Step for Vscode {
549
549
if config. dry_run ( ) {
550
550
return ;
551
551
}
552
- t ! ( create_vscode_settings_maybe( & config) ) ;
552
+ loop {
553
+ let created = t ! ( create_vscode_settings_maybe( & config) ) ;
554
+ if created {
555
+ break ;
556
+ }
557
+ }
553
558
}
554
559
}
555
560
556
561
/// Create a `.vscode/settings.json` file for rustc development, or just print it
557
- fn create_vscode_settings_maybe ( config : & Config ) -> io:: Result < ( ) > {
562
+ /// If this method should be re-called, it returns `false`.
563
+ fn create_vscode_settings_maybe ( config : & Config ) -> io:: Result < bool > {
558
564
let ( current_hash, historical_hashes) = SETTINGS_HASHES . split_last ( ) . unwrap ( ) ;
559
565
let vscode_settings = config. src . join ( ".vscode" ) . join ( "settings.json" ) ;
560
566
// If None, no settings.json exists
@@ -567,7 +573,7 @@ fn create_vscode_settings_maybe(config: &Config) -> io::Result<()> {
567
573
hasher. update ( & current) ;
568
574
let hash = hex:: encode ( hasher. finalize ( ) . as_slice ( ) ) ;
569
575
if hash == * current_hash {
570
- return Ok ( ( ) ) ;
576
+ return Ok ( true ) ;
571
577
} else if historical_hashes. contains ( & hash. as_str ( ) ) {
572
578
mismatched_settings = Some ( true ) ;
573
579
} else {
@@ -593,7 +599,7 @@ fn create_vscode_settings_maybe(config: &Config) -> io::Result<()> {
593
599
Some ( PromptResult :: Print ) => false ,
594
600
_ => {
595
601
println ! ( "Ok, skipping settings!" ) ;
596
- return Ok ( ( ) ) ;
602
+ return Ok ( true ) ;
597
603
}
598
604
} ;
599
605
if should_create {
@@ -620,5 +626,5 @@ fn create_vscode_settings_maybe(config: &Config) -> io::Result<()> {
620
626
} else {
621
627
println ! ( "\n {RUST_ANALYZER_SETTINGS}" ) ;
622
628
}
623
- Ok ( ( ) )
629
+ Ok ( should_create )
624
630
}
0 commit comments