@@ -705,7 +705,7 @@ impl Config {
705705 // FIXME @alibektas : Server's health uses error sink but in other places it is not used atm.
706706 /// Changes made to client and global configurations will partially not be reflected even after `.apply_change()` was called.
707707 /// The return tuple's bool component signals whether the `GlobalState` should call its `update_configuration()` method.
708- pub fn apply_change (
708+ fn apply_change_with_sink (
709709 & self ,
710710 change : ConfigChange ,
711711 error_sink : & mut ConfigError ,
@@ -809,10 +809,13 @@ impl Config {
809809 ( config, should_update)
810810 }
811811
812- pub fn apply_change_whatever ( & self , change : ConfigChange ) -> ( Config , ConfigError ) {
812+ /// Given `change` this generates a new `Config`, thereby collecting errors of type `ConfigError`.
813+ /// If there are changes that have global/client level effect, the last component of the return type
814+ /// will be set to `true`, which should be used by the `GlobalState` to update itself.
815+ pub fn apply_change ( & self , change : ConfigChange ) -> ( Config , ConfigError , bool ) {
813816 let mut e = ConfigError ( vec ! [ ] ) ;
814- let ( config, _ ) = self . apply_change ( change, & mut e) ;
815- ( config, e)
817+ let ( config, should_update ) = self . apply_change_with_sink ( change, & mut e) ;
818+ ( config, e, should_update )
816819 }
817820}
818821
@@ -3300,8 +3303,7 @@ mod tests {
33003303 "server" : null,
33013304 } } ) ) ;
33023305
3303- let mut error_sink = ConfigError :: default ( ) ;
3304- ( config, _) = config. apply_change ( change, & mut error_sink) ;
3306+ ( config, _, _) = config. apply_change ( change) ;
33053307 assert_eq ! ( config. proc_macro_srv( ) , None ) ;
33063308 }
33073309
@@ -3320,8 +3322,7 @@ mod tests {
33203322 "server" : project_root( ) . display( ) . to_string( ) ,
33213323 } } ) ) ;
33223324
3323- let mut error_sink = ConfigError :: default ( ) ;
3324- ( config, _) = config. apply_change ( change, & mut error_sink) ;
3325+ ( config, _, _) = config. apply_change ( change) ;
33253326 assert_eq ! ( config. proc_macro_srv( ) , Some ( AbsPathBuf :: try_from( project_root( ) ) . unwrap( ) ) ) ;
33263327 }
33273328
@@ -3342,8 +3343,7 @@ mod tests {
33423343 "server" : "./server"
33433344 } } ) ) ;
33443345
3345- let mut error_sink = ConfigError :: default ( ) ;
3346- ( config, _) = config. apply_change ( change, & mut error_sink) ;
3346+ ( config, _, _) = config. apply_change ( change) ;
33473347
33483348 assert_eq ! (
33493349 config. proc_macro_srv( ) ,
@@ -3367,8 +3367,7 @@ mod tests {
33673367 "rust" : { "analyzerTargetDir" : null }
33683368 } ) ) ;
33693369
3370- let mut error_sink = ConfigError :: default ( ) ;
3371- ( config, _) = config. apply_change ( change, & mut error_sink) ;
3370+ ( config, _, _) = config. apply_change ( change) ;
33723371 assert_eq ! ( config. cargo_targetDir( ) , & None ) ;
33733372 assert ! (
33743373 matches!( config. flycheck( ) , FlycheckConfig :: CargoCommand { options, .. } if options. target_dir. is_none( ) )
@@ -3390,8 +3389,7 @@ mod tests {
33903389 "rust" : { "analyzerTargetDir" : true }
33913390 } ) ) ;
33923391
3393- let mut error_sink = ConfigError :: default ( ) ;
3394- ( config, _) = config. apply_change ( change, & mut error_sink) ;
3392+ ( config, _, _) = config. apply_change ( change) ;
33953393
33963394 assert_eq ! ( config. cargo_targetDir( ) , & Some ( TargetDirectory :: UseSubdirectory ( true ) ) ) ;
33973395 assert ! (
@@ -3414,8 +3412,7 @@ mod tests {
34143412 "rust" : { "analyzerTargetDir" : "other_folder" }
34153413 } ) ) ;
34163414
3417- let mut error_sink = ConfigError :: default ( ) ;
3418- ( config, _) = config. apply_change ( change, & mut error_sink) ;
3415+ ( config, _, _) = config. apply_change ( change) ;
34193416
34203417 assert_eq ! (
34213418 config. cargo_targetDir( ) ,
0 commit comments