File tree 1 file changed +8
-8
lines changed
src/bootstrap/src/core/config
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 {
814
814
exit ! ( 2 ) ;
815
815
} ) ;
816
816
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| {
820
818
eprintln ! ( "ERROR: Failed to parse '{}': {e}" , include_path. display( ) ) ;
821
819
exit ! ( 2 ) ;
822
820
} ) ;
@@ -1424,13 +1422,15 @@ impl Config {
1424
1422
Self :: get_toml ( & builder_config_path)
1425
1423
}
1426
1424
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)
1430
1431
}
1431
1432
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 > {
1434
1434
let contents =
1435
1435
t ! ( fs:: read_to_string( file) , format!( "config file {} not found" , file. display( ) ) ) ;
1436
1436
// Deserialize to Value and then TomlConfig to prevent the Deserialize impl of
You can’t perform that action at this time.
0 commit comments