Skip to content

Commit

Permalink
Reorder apply_args to match struct definition
Browse files Browse the repository at this point in the history
  • Loading branch information
dtolnay committed Sep 23, 2023
1 parent 753595e commit 905b808
Showing 1 changed file with 49 additions and 49 deletions.
98 changes: 49 additions & 49 deletions src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -330,43 +326,52 @@ 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 {
line.arg("--jobs");
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 {
Expand All @@ -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");
Expand Down

0 comments on commit 905b808

Please sign in to comment.