@@ -701,7 +701,7 @@ impl Config {
701701 // FIXME @alibektas : Server's health uses error sink but in other places it is not used atm.
702702 /// Changes made to client and global configurations will partially not be reflected even after `.apply_change()` was called.
703703 /// The return tuple's bool component signals whether the `GlobalState` should call its `update_configuration()` method.
704- pub fn apply_change (
704+ fn apply_change_with_sink (
705705 & self ,
706706 change : ConfigChange ,
707707 error_sink : & mut ConfigError ,
@@ -805,10 +805,13 @@ impl Config {
805805 ( config, should_update)
806806 }
807807
808- pub fn apply_change_whatever ( & self , change : ConfigChange ) -> ( Config , ConfigError ) {
808+ /// Given `change` this generates a new `Config`, thereby collecting errors of type `ConfigError`.
809+ /// If there are changes that have global/client level effect, the last component of the return type
810+ /// will be set to `true`, which should be used by the `GlobalState` to update itself.
811+ pub fn apply_change ( & self , change : ConfigChange ) -> ( Config , ConfigError , bool ) {
809812 let mut e = ConfigError ( vec ! [ ] ) ;
810- let ( config, _ ) = self . apply_change ( change, & mut e) ;
811- ( config, e)
813+ let ( config, should_update ) = self . apply_change_with_sink ( change, & mut e) ;
814+ ( config, e, should_update )
812815 }
813816}
814817
@@ -3293,8 +3296,7 @@ mod tests {
32933296 "server" : null,
32943297 } } ) ) ;
32953298
3296- let mut error_sink = ConfigError :: default ( ) ;
3297- ( config, _) = config. apply_change ( change, & mut error_sink) ;
3299+ ( config, _, _) = config. apply_change ( change) ;
32983300 assert_eq ! ( config. proc_macro_srv( ) , None ) ;
32993301 }
33003302
@@ -3313,8 +3315,7 @@ mod tests {
33133315 "server" : project_root( ) . display( ) . to_string( ) ,
33143316 } } ) ) ;
33153317
3316- let mut error_sink = ConfigError :: default ( ) ;
3317- ( config, _) = config. apply_change ( change, & mut error_sink) ;
3318+ ( config, _, _) = config. apply_change ( change) ;
33183319 assert_eq ! ( config. proc_macro_srv( ) , Some ( AbsPathBuf :: try_from( project_root( ) ) . unwrap( ) ) ) ;
33193320 }
33203321
@@ -3335,8 +3336,7 @@ mod tests {
33353336 "server" : "./server"
33363337 } } ) ) ;
33373338
3338- let mut error_sink = ConfigError :: default ( ) ;
3339- ( config, _) = config. apply_change ( change, & mut error_sink) ;
3339+ ( config, _, _) = config. apply_change ( change) ;
33403340
33413341 assert_eq ! (
33423342 config. proc_macro_srv( ) ,
@@ -3360,8 +3360,7 @@ mod tests {
33603360 "rust" : { "analyzerTargetDir" : null }
33613361 } ) ) ;
33623362
3363- let mut error_sink = ConfigError :: default ( ) ;
3364- ( config, _) = config. apply_change ( change, & mut error_sink) ;
3363+ ( config, _, _) = config. apply_change ( change) ;
33653364 assert_eq ! ( config. cargo_targetDir( ) , & None ) ;
33663365 assert ! (
33673366 matches!( config. flycheck( ) , FlycheckConfig :: CargoCommand { options, .. } if options. target_dir. is_none( ) )
@@ -3383,8 +3382,7 @@ mod tests {
33833382 "rust" : { "analyzerTargetDir" : true }
33843383 } ) ) ;
33853384
3386- let mut error_sink = ConfigError :: default ( ) ;
3387- ( config, _) = config. apply_change ( change, & mut error_sink) ;
3385+ ( config, _, _) = config. apply_change ( change) ;
33883386
33893387 assert_eq ! ( config. cargo_targetDir( ) , & Some ( TargetDirectory :: UseSubdirectory ( true ) ) ) ;
33903388 assert ! (
@@ -3407,8 +3405,7 @@ mod tests {
34073405 "rust" : { "analyzerTargetDir" : "other_folder" }
34083406 } ) ) ;
34093407
3410- let mut error_sink = ConfigError :: default ( ) ;
3411- ( config, _) = config. apply_change ( change, & mut error_sink) ;
3408+ ( config, _, _) = config. apply_change ( change) ;
34123409
34133410 assert_eq ! (
34143411 config. cargo_targetDir( ) ,
0 commit comments