From 905b808589a2f482d05566e2b10d496bb221f888 Mon Sep 17 00:00:00 2001 From: David Tolnay Date: Sat, 23 Sep 2023 13:39:40 -0700 Subject: [PATCH] Reorder apply_args to match struct definition --- src/main.rs | 98 ++++++++++++++++++++++++++--------------------------- 1 file changed, 49 insertions(+), 49 deletions(-) diff --git a/src/main.rs b/src/main.rs index 5d7c59c..fbdfcd1 100644 --- a/src/main.rs +++ b/src/main.rs @@ -261,32 +261,28 @@ fn apply_args(cmd: &mut Command, args: &Expand, color: &Coloring, outfile: &Path line.arg("rustc"); - line.arg("--profile"); - if let Some(profile) = &args.profile { - line.arg(profile); - } else if args.tests && args.test.is_none() { - if args.release { - line.arg("bench"); - } else { - line.arg("test"); - } - } else if args.release { - line.arg("release"); - } else { - line.arg("check"); + if args.verbose { + line.arg("--verbose"); } - if let Some(features) = &args.features { - line.arg("--features"); - line.arg(features); + line.arg("--color"); + match color { + Coloring::Auto => line.arg(if cfg!(not(windows)) && io::stderr().is_terminal() { + "always" + } else { + "never" + }), + color => line.arg(color.to_possible_value().unwrap().get_name()), } - if args.all_features { - line.arg("--all-features"); + for unstable_flag in &args.unstable_flags { + line.arg("-Z"); + line.arg(unstable_flag); } - if args.no_default_features { - line.arg("--no-default-features"); + if let Some(package) = &args.package { + line.arg("--package"); + line.args(package); } let mut has_explicit_build_target = false; @@ -330,24 +326,17 @@ fn apply_args(cmd: &mut Command, args: &Expand, color: &Coloring, outfile: &Path } } - if let Some(target) = &args.target { - line.arg("--target"); - line.arg(target); - } - - if let Some(target_dir) = &args.target_dir { - line.arg("--target-dir"); - line.arg(target_dir); + if let Some(features) = &args.features { + line.arg("--features"); + line.arg(features); } - if let Some(manifest_path) = &args.manifest_path { - line.arg("--manifest-path"); - line.arg(manifest_path); + if args.all_features { + line.arg("--all-features"); } - if let Some(package) = &args.package { - line.arg("--package"); - line.args(package); + if args.no_default_features { + line.arg("--no-default-features"); } if let Some(jobs) = args.jobs { @@ -355,18 +344,34 @@ fn apply_args(cmd: &mut Command, args: &Expand, color: &Coloring, outfile: &Path line.arg(jobs.to_string()); } - if args.verbose { - line.arg("--verbose"); + line.arg("--profile"); + if let Some(profile) = &args.profile { + line.arg(profile); + } else if args.tests && args.test.is_none() { + if args.release { + line.arg("bench"); + } else { + line.arg("test"); + } + } else if args.release { + line.arg("release"); + } else { + line.arg("check"); } - line.arg("--color"); - match color { - Coloring::Auto => line.arg(if cfg!(not(windows)) && io::stderr().is_terminal() { - "always" - } else { - "never" - }), - color => line.arg(color.to_possible_value().unwrap().get_name()), + if let Some(target) = &args.target { + line.arg("--target"); + line.arg(target); + } + + if let Some(target_dir) = &args.target_dir { + line.arg("--target-dir"); + line.arg(target_dir); + } + + if let Some(manifest_path) = &args.manifest_path { + line.arg("--manifest-path"); + line.arg(manifest_path); } if args.frozen { @@ -381,11 +386,6 @@ fn apply_args(cmd: &mut Command, args: &Expand, color: &Coloring, outfile: &Path line.arg("--offline"); } - for unstable_flag in &args.unstable_flags { - line.arg("-Z"); - line.arg(unstable_flag); - } - line.arg("--"); line.arg("-o");