Browse Source

Remove Display trait

Inline match command to subcommand for make_cargo_build_command
pull/21/head
Steve Cook 2 years ago
parent
commit
c7b6482f9c
  1. 12
      src/command.rs
  2. 9
      src/lib.rs

12
src/command.rs

@ -1,5 +1,4 @@
use clap::{AppSettings, Args, Parser, ValueEnum}; use clap::{AppSettings, Args, Parser, ValueEnum};
use std::fmt::{Display, Formatter};
#[derive(Parser)] #[derive(Parser)]
#[clap(name = "cargo")] #[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"),
}
}
}

9
src/lib.rs

@ -118,9 +118,16 @@ pub fn make_cargo_build_command(
command.arg("-Z").arg("build-std"); 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 command
.env("RUSTFLAGS", rust_flags) .env("RUSTFLAGS", rust_flags)
.arg(&cmd.to_string()) .arg(cmd)
.arg("--target") .arg("--target")
.arg("armv6k-nintendo-3ds") .arg("armv6k-nintendo-3ds")
.arg("--message-format") .arg("--message-format")

Loading…
Cancel
Save