@@ -85,7 +85,6 @@ pub struct Config {
8585 pub jobs : Option < u32 > ,
8686 pub cmd : Subcommand ,
8787 pub incremental : bool ,
88- pub dry_run : DryRun ,
8988 /// Arguments appearing after `--` to be forwarded to tools,
9089 /// e.g. `--fix-broken` or test arguments.
9190 pub free_args : Vec < String > ,
@@ -395,7 +394,7 @@ impl Target {
395394/// `Config` structure.
396395#[ derive( Deserialize , Default ) ]
397396#[ serde( deny_unknown_fields, rename_all = "kebab-case" ) ]
398- pub struct TomlConfig {
397+ struct TomlConfig {
399398 changelog_seen : Option < usize > ,
400399 build : Option < Build > ,
401400 install : Option < Install > ,
@@ -774,17 +773,19 @@ impl Config {
774773 args
775774 }
776775
777- pub fn parse ( args : & [ String ] , custom_toml_config : Option < TomlConfig > ) -> Config {
776+ pub fn parse ( args : & [ String ] , custom_toml_config : Option < & str > ) -> Config {
778777 let mut flags = Flags :: parse ( & args) ;
779778 let mut config = Config :: default_opts ( ) ;
780779
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 {
782783 set_cfg_path_and_return_toml_cfg (
783784 config. src . clone ( ) ,
784785 flags. config . clone ( ) ,
785786 & mut config. config ,
786787 )
787- } ) ;
788+ } ;
788789
789790 config. minimal_config = MinimalConfig :: parse ( & flags, toml. build . clone ( ) ) ;
790791
@@ -814,11 +815,6 @@ impl Config {
814815 crate :: detail_exit ( 1 ) ;
815816 }
816817
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-
822818 if let Some ( include) = & toml. profile {
823819 let mut include_path = config. src . clone ( ) ;
824820 include_path. push ( "src" ) ;
@@ -831,6 +827,11 @@ impl Config {
831827
832828 config. changelog_seen = toml. changelog_seen ;
833829
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+
834835 set ( & mut config. out , flags. build_dir . or_else ( || build. build_dir . map ( PathBuf :: from) ) ) ;
835836 // NOTE: Bootstrap spawns various commands with different working directories.
836837 // To avoid writing to random places on the file system, `config.out` needs to be an absolute path.
0 commit comments