From c7b6482f9c8e8e0a511fcef04609a369ff355719 Mon Sep 17 00:00:00 2001 From: Steve Cook Date: Sat, 23 Jul 2022 19:49:08 -0400 Subject: [PATCH] Remove Display trait Inline match command to subcommand for make_cargo_build_command --- src/command.rs | 12 ------------ src/lib.rs | 9 ++++++++- 2 files changed, 8 insertions(+), 13 deletions(-) diff --git a/src/command.rs b/src/command.rs index 1efc74b..54f9eef 100644 --- a/src/command.rs +++ b/src/command.rs @@ -1,5 +1,4 @@ use clap::{AppSettings, Args, Parser, ValueEnum}; -use std::fmt::{Display, Formatter}; #[derive(Parser)] #[clap(name = "cargo")] @@ -35,14 +34,3 @@ impl CargoCommand { ) } } - -impl Display for CargoCommand { - fn fmt(&self, f: &mut Formatter<'_>) -> std::fmt::Result { - match self { - CargoCommand::Build | CargoCommand::Run => write!(f, "build"), - CargoCommand::Test => write!(f, "test"), - CargoCommand::Check => write!(f, "check"), - CargoCommand::Clippy => write!(f, "clippy"), - } - } -} diff --git a/src/lib.rs b/src/lib.rs index e50023d..045690d 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -118,9 +118,16 @@ pub fn make_cargo_build_command( command.arg("-Z").arg("build-std"); } + let cmd = match cmd { + CargoCommand::Build | CargoCommand::Run => "build", + CargoCommand::Test => "test", + CargoCommand::Check => "check", + CargoCommand::Clippy => "clippy", + }; + command .env("RUSTFLAGS", rust_flags) - .arg(&cmd.to_string()) + .arg(cmd) .arg("--target") .arg("armv6k-nintendo-3ds") .arg("--message-format")