From 7e99e1a9a5104a37e68696f75921a7aaf8e3a99e Mon Sep 17 00:00:00 2001 From: Mark Drobnak Date: Sun, 24 Jul 2022 14:36:23 -0700 Subject: [PATCH 1/2] Move build-std argument after the subcommand to fix clippy This fixes `cargo +nightly 3ds clippy`. See this thread: https://rust-lang.zulipchat.com/#narrow/stream/257328-clippy/topic/-Zbuild-std.20and.20clippy.3F/near/290622458 --- src/lib.rs | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/lib.rs b/src/lib.rs index 045690d..9337deb 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -113,11 +113,6 @@ pub fn make_cargo_build_command( let sysroot = find_sysroot(); let mut command = Command::new(cargo); - if !sysroot.join("lib/rustlib/armv6k-nintendo-3ds").exists() { - eprintln!("No pre-build std found, using build-std"); - command.arg("-Z").arg("build-std"); - } - let cmd = match cmd { CargoCommand::Build | CargoCommand::Run => "build", CargoCommand::Test => "test", @@ -137,6 +132,11 @@ pub fn make_cargo_build_command( .stdin(Stdio::inherit()) .stderr(Stdio::inherit()); + if !sysroot.join("lib/rustlib/armv6k-nintendo-3ds").exists() { + eprintln!("No pre-build std found, using build-std"); + command.arg("-Z").arg("build-std"); + } + command } From cb3a9a19ff9f3119425e3787ede0454520ca1800 Mon Sep 17 00:00:00 2001 From: Mark Drobnak Date: Mon, 25 Jul 2022 21:27:58 -0700 Subject: [PATCH 2/2] Set build-std flag before trailing arguments --- src/lib.rs | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/src/lib.rs b/src/lib.rs index 9337deb..9d43156 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -126,17 +126,19 @@ pub fn make_cargo_build_command( .arg("--target") .arg("armv6k-nintendo-3ds") .arg("--message-format") - .arg(message_format) - .args(args) - .stdout(Stdio::piped()) - .stdin(Stdio::inherit()) - .stderr(Stdio::inherit()); + .arg(message_format); if !sysroot.join("lib/rustlib/armv6k-nintendo-3ds").exists() { eprintln!("No pre-build std found, using build-std"); command.arg("-Z").arg("build-std"); } + command + .args(args) + .stdout(Stdio::piped()) + .stdin(Stdio::inherit()) + .stderr(Stdio::inherit()); + command }