@@ -85,7 +85,6 @@ pub struct Config {
85
85
pub jobs : Option < u32 > ,
86
86
pub cmd : Subcommand ,
87
87
pub incremental : bool ,
88
- pub dry_run : DryRun ,
89
88
/// Arguments appearing after `--` to be forwarded to tools,
90
89
/// e.g. `--fix-broken` or test arguments.
91
90
pub free_args : Vec < String > ,
@@ -395,7 +394,7 @@ impl Target {
395
394
/// `Config` structure.
396
395
#[ derive( Deserialize , Default ) ]
397
396
#[ serde( deny_unknown_fields, rename_all = "kebab-case" ) ]
398
- pub struct TomlConfig {
397
+ struct TomlConfig {
399
398
changelog_seen : Option < usize > ,
400
399
build : Option < Build > ,
401
400
install : Option < Install > ,
@@ -774,17 +773,19 @@ impl Config {
774
773
args
775
774
}
776
775
777
- pub fn parse ( args : & [ String ] , custom_toml_config : Option < TomlConfig > ) -> Config {
776
+ pub fn parse ( args : & [ String ] , custom_toml_config : Option < & str > ) -> Config {
778
777
let mut flags = Flags :: parse ( & args) ;
779
778
let mut config = Config :: default_opts ( ) ;
780
779
781
- let mut toml: TomlConfig = custom_toml_config. unwrap_or_else ( || {
780
+ let mut toml: TomlConfig = if let Some ( custom_toml_config) = custom_toml_config {
781
+ toml:: from_str ( custom_toml_config) . unwrap ( )
782
+ } else {
782
783
set_cfg_path_and_return_toml_cfg (
783
784
config. src . clone ( ) ,
784
785
flags. config . clone ( ) ,
785
786
& mut config. config ,
786
787
)
787
- } ) ;
788
+ } ;
788
789
789
790
config. minimal_config = MinimalConfig :: parse ( & flags, toml. build . clone ( ) ) ;
790
791
@@ -814,11 +815,6 @@ impl Config {
814
815
crate :: detail_exit ( 1 ) ;
815
816
}
816
817
817
- let build = toml. build . clone ( ) . unwrap_or_default ( ) ;
818
- if let Some ( file_build) = build. build . as_ref ( ) {
819
- config. build = TargetSelection :: from_user ( file_build) ;
820
- } ;
821
-
822
818
if let Some ( include) = & toml. profile {
823
819
let mut include_path = config. src . clone ( ) ;
824
820
include_path. push ( "src" ) ;
@@ -831,6 +827,11 @@ impl Config {
831
827
832
828
config. changelog_seen = toml. changelog_seen ;
833
829
830
+ let build = toml. build . unwrap_or_default ( ) ;
831
+ if let Some ( file_build) = build. build {
832
+ config. build = TargetSelection :: from_user ( & file_build) ;
833
+ } ;
834
+
834
835
set ( & mut config. out , flags. build_dir . or_else ( || build. build_dir . map ( PathBuf :: from) ) ) ;
835
836
// NOTE: Bootstrap spawns various commands with different working directories.
836
837
// To avoid writing to random places on the file system, `config.out` needs to be an absolute path.
0 commit comments