Skip to content

Commit

Permalink
clippy
Browse files Browse the repository at this point in the history
  • Loading branch information
lucasfernog-crabnebula committed May 30, 2024
1 parent 9b38335 commit e9f335e
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 16 deletions.
4 changes: 2 additions & 2 deletions crates/packager/src/cli/config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,7 @@ pub fn load_configs_from_cargo_workspace(
config.name.replace(package.name.clone());
}
if config.product_name.is_empty() {
config.product_name = package.name.clone();
config.product_name.clone_from(&package.name);
}
if config.version.is_empty() {
config.version = package.version.to_string();
Expand Down Expand Up @@ -152,7 +152,7 @@ pub fn load_configs_from_cargo_workspace(
}

if config.description.is_none() {
config.description = package.description.clone();
config.description.clone_from(&package.description);
}
if config.authors.is_none() {
config.authors = Some(package.authors.clone());
Expand Down
2 changes: 1 addition & 1 deletion crates/packager/src/cli/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -161,7 +161,7 @@ fn run_cli(cli: Cli) -> Result<()> {

for (_, config) in &mut configs {
if let Some(dir) = &cli_out_dir {
config.out_dir = dir.clone()
config.out_dir.clone_from(dir)
}

if let Some(formats) = &cli.formats {
Expand Down
4 changes: 2 additions & 2 deletions crates/packager/src/package/nsis/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -373,8 +373,8 @@ fn build_nsis_app_installer(ctx: &Context, nsis_path: &Path) -> crate::Result<Ve
let mut custom_template_path = None;
let mut custom_language_files = None;
if let Some(nsis) = config.nsis() {
custom_template_path = nsis.template.clone();
custom_language_files = nsis.custom_language_files.clone();
custom_template_path.clone_from(&nsis.template);
custom_language_files.clone_from(&nsis.custom_language_files);
install_mode = nsis.install_mode;
if let Some(langs) = &nsis.languages {
languages.clear();
Expand Down
12 changes: 1 addition & 11 deletions crates/packager/src/shell.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,27 +6,17 @@
use std::{
borrow::Cow,
io::{BufRead, BufReader},
process::{Command, ExitStatus, Output, Stdio},
process::{Command, Output, Stdio},
sync::{Arc, Mutex},
};

pub trait CommandExt {
// The `piped` method sets the stdout and stderr to properly
// show the command output in the Node.js wrapper.
fn piped(&mut self) -> std::io::Result<ExitStatus>;
fn output_ok(&mut self) -> std::io::Result<Output>;
fn output_ok_info(&mut self) -> std::io::Result<Output>;
fn output_ok_inner(&mut self, level: tracing::Level) -> std::io::Result<Output>;
}

impl CommandExt for Command {
fn piped(&mut self) -> std::io::Result<ExitStatus> {
self.stdout(os_pipe::dup_stdout()?);
self.stderr(os_pipe::dup_stderr()?);
tracing::debug!("Running Command `{self:?}`");
self.status().map_err(Into::into)
}

fn output_ok(&mut self) -> std::io::Result<Output> {
self.output_ok_inner(tracing::Level::DEBUG)
}
Expand Down

0 comments on commit e9f335e

Please sign in to comment.