aboutsummaryrefslogtreecommitdiffhomepage
path: root/crates/shirabe/src/command/exec_command.rs
diff options
context:
space:
mode:
authornsfisis <nsfisis@gmail.com>2026-06-20 01:16:50 +0900
committernsfisis <nsfisis@gmail.com>2026-06-20 02:22:41 +0900
commitefec43b3b8827820cf35fe1b73d8e33f5fe84eb4 (patch)
treea62bbba72324de48be5f8e689559f8d9e288fc61 /crates/shirabe/src/command/exec_command.rs
parentcac18ef73a39b4ac41fa4d6ccb753804d4c42cb7 (diff)
downloadphp-shirabe-efec43b3b8827820cf35fe1b73d8e33f5fe84eb4.tar.gz
php-shirabe-efec43b3b8827820cf35fe1b73d8e33f5fe84eb4.tar.zst
php-shirabe-efec43b3b8827820cf35fe1b73d8e33f5fe84eb4.zip
refactor: auto-fix clippy warnings
Diffstat (limited to 'crates/shirabe/src/command/exec_command.rs')
-rw-r--r--crates/shirabe/src/command/exec_command.rs32
1 files changed, 19 insertions, 13 deletions
diff --git a/crates/shirabe/src/command/exec_command.rs b/crates/shirabe/src/command/exec_command.rs
index aef22a3..c4a1e94 100644
--- a/crates/shirabe/src/command/exec_command.rs
+++ b/crates/shirabe/src/command/exec_command.rs
@@ -26,6 +26,12 @@ pub struct ExecCommand {
base_command_data: BaseCommandData,
}
+impl Default for ExecCommand {
+ fn default() -> Self {
+ Self::new()
+ }
+}
+
impl ExecCommand {
pub fn new() -> Self {
let mut command = ExecCommand {
@@ -61,10 +67,10 @@ impl ExecCommand {
let mut binaries: Vec<String> = Vec::new();
let mut previous_bin: Option<String> = None;
for bin in bins.iter().chain(local_bins.iter()) {
- if let Some(prev) = &previous_bin {
- if bin == &format!("{}.bat", prev) {
- continue;
- }
+ if let Some(prev) = &previous_bin
+ && bin == &format!("{}.bat", prev)
+ {
+ continue;
}
previous_bin = Some(bin.clone());
binaries.push(basename(bin));
@@ -201,13 +207,13 @@ impl Command for ExecCommand {
// Application handle (deferred with the Application shared-ownership work). Until then the
// working-directory restore is skipped.
let initial_working_directory: Option<String> = None;
- if let Some(ref iwd) = initial_working_directory {
- if getcwd().as_deref() != Some(iwd.as_str()) {
- chdir(iwd).map_err(|e| RuntimeException {
- message: format!("Could not switch back to working directory \"{}\"", iwd),
- code: 0,
- })?;
- }
+ if let Some(ref iwd) = initial_working_directory
+ && getcwd().as_deref() != Some(iwd.as_str())
+ {
+ chdir(iwd).map_err(|e| RuntimeException {
+ message: format!("Could not switch back to working directory \"{}\"", iwd),
+ code: 0,
+ })?;
}
let args = input
@@ -221,12 +227,12 @@ impl Command for ExecCommand {
})
.unwrap_or_default();
- Ok(dispatcher.borrow_mut().dispatch_script(
+ dispatcher.borrow_mut().dispatch_script(
"__exec_command",
true,
args,
indexmap::IndexMap::new(),
- )?)
+ )
}
fn initialize(