From 15b8e7993180505f9653e77cd37fab66a613671f Mon Sep 17 00:00:00 2001 From: Nikolay Arhipov Date: Mon, 9 Sep 2024 13:58:45 +0300 Subject: [PATCH] chore: clippy fixes (#27) --- src/check.rs | 3 +-- src/commands/build.rs | 4 ++-- src/commands/coredump.rs | 25 ++++++++++++------------- src/commands/logs.rs | 2 +- 4 files changed, 16 insertions(+), 18 deletions(-) diff --git a/src/check.rs b/src/check.rs index d50ae10..a1d860c 100644 --- a/src/check.rs +++ b/src/check.rs @@ -43,9 +43,8 @@ pub fn set_cargo_config_env() -> anyhow::Result<()> { serde_json::from_reader(stdout) .context("failed to deserialize `cargo config get` output") }) - .map_err(|e| { + .inspect_err(|_| { let _ = child.kill(); - e })?; let status = child.wait().context("running `cargo config get` command")?; diff --git a/src/commands/build.rs b/src/commands/build.rs index 99b46b8..28a62ff 100644 --- a/src/commands/build.rs +++ b/src/commands/build.rs @@ -27,7 +27,7 @@ pub struct Build { #[command(subcommand)] cmd: BuildCmd, - /// An alphanumeric string of 9 characters. Used as a fallback in case title_id is not defined in Cargo.toml. + /// An alphanumeric string of 9 characters. Used as a fallback in case `title_id` is not defined in Cargo.toml. #[arg(long, env="VITA_DEFAULT_TITLE_ID", value_parser = clap::value_parser!(TitleId))] default_title_id: Option, @@ -53,7 +53,7 @@ enum BuildCmd { #[derive(Args, Debug)] struct Eboot { - /// Uploads eboot.bin to ux0:app/{title_id}/eboot.bin + /// Uploads eboot.bin to `ux0:app/{title_id}/eboot.bin` #[arg(long, default_value = "false")] update: bool, /// Runs the updated app. If multiple eboot files are updated, only the last one is run. diff --git a/src/commands/coredump.rs b/src/commands/coredump.rs index e948d43..082ea23 100644 --- a/src/commands/coredump.rs +++ b/src/commands/coredump.rs @@ -89,19 +89,18 @@ impl Executor for Coredump { tmp_file.to_path_buf() }; - let elf = match &args.elf { - Some(elf) => elf.clone(), - None => { - let (_, pkg, target_directory) = parse_crate_metadata(None)?; - let pkg = pkg.context("Not in a crate")?; - - target_directory - .join(VITA_TARGET) - .join(&args.profile) - .join(pkg.name) - .with_extension("elf") - .to_string() - } + let elf = if let Some(elf) = &args.elf { + elf.clone() + } else { + let (_, pkg, target_directory) = parse_crate_metadata(None)?; + let pkg = pkg.context("Not in a crate")?; + + target_directory + .join(VITA_TARGET) + .join(&args.profile) + .join(pkg.name) + .with_extension("elf") + .to_string() }; let mut command = Command::new("vita-parse-core"); diff --git a/src/commands/logs.rs b/src/commands/logs.rs index f3cbb71..5988012 100644 --- a/src/commands/logs.rs +++ b/src/commands/logs.rs @@ -26,7 +26,7 @@ pub struct Logs { pub enum LogsCmd { /// Start a TCP server on 0.0.0.0 and print to stdout all bytes read from the socket Listen, - /// Reconfigures PrincessLog via vitacompanion. + /// Reconfigures `PrincessLog` via vitacompanion. /// This will upload the configuration file with the ip address of your host and a port to your Vita. Configure(Configure), }