File tree Expand file tree Collapse file tree 1 file changed +8
-8
lines changed
src/bootstrap/src/core/config Expand file tree Collapse file tree 1 file changed +8
-8
lines changed Original file line number Diff line number Diff line change @@ -814,9 +814,7 @@ impl Merge for TomlConfig {
814814 exit ! ( 2 ) ;
815815 } ) ;
816816
817- // FIXME: Similar to `Config::parse_inner`, allow passing a custom `get_toml` from the caller to
818- // improve testability since `Config::get_toml` does nothing when `cfg(test)` is enabled.
819- let included_toml = Config :: get_toml ( & include_path) . unwrap_or_else ( |e| {
817+ let included_toml = Config :: get_toml_inner ( & include_path) . unwrap_or_else ( |e| {
820818 eprintln ! ( "ERROR: Failed to parse '{}': {e}" , include_path. display( ) ) ;
821819 exit ! ( 2 ) ;
822820 } ) ;
@@ -1424,13 +1422,15 @@ impl Config {
14241422 Self :: get_toml ( & builder_config_path)
14251423 }
14261424
1427- #[ cfg( test) ]
1428- pub ( crate ) fn get_toml ( _: & Path ) -> Result < TomlConfig , toml:: de:: Error > {
1429- Ok ( TomlConfig :: default ( ) )
1425+ pub ( crate ) fn get_toml ( file : & Path ) -> Result < TomlConfig , toml:: de:: Error > {
1426+ #[ cfg( test) ]
1427+ return Ok ( TomlConfig :: default ( ) ) ;
1428+
1429+ #[ cfg( not( test) ) ]
1430+ Self :: get_toml_inner ( file)
14301431 }
14311432
1432- #[ cfg( not( test) ) ]
1433- pub ( crate ) fn get_toml ( file : & Path ) -> Result < TomlConfig , toml:: de:: Error > {
1433+ fn get_toml_inner ( file : & Path ) -> Result < TomlConfig , toml:: de:: Error > {
14341434 let contents =
14351435 t ! ( fs:: read_to_string( file) , format!( "config file {} not found" , file. display( ) ) ) ;
14361436 // Deserialize to Value and then TomlConfig to prevent the Deserialize impl of
You can’t perform that action at this time.
0 commit comments