diff options
| author | nsfisis <nsfisis@gmail.com> | 2026-06-27 03:52:05 +0900 |
|---|---|---|
| committer | nsfisis <nsfisis@gmail.com> | 2026-06-27 04:21:34 +0900 |
| commit | 2b51554ff59d1e5cbf8dd2db65d278b0202a9102 (patch) | |
| tree | f4d9b0abf4df9b5e363e3bd65511d70e3d5ada00 /crates/shirabe-external-packages/src/symfony/process/process.rs | |
| parent | cc07b5abb83a40d678401c335bdc49bb81b72c5f (diff) | |
| download | php-shirabe-2b51554ff59d1e5cbf8dd2db65d278b0202a9102.tar.gz php-shirabe-2b51554ff59d1e5cbf8dd2db65d278b0202a9102.tar.zst php-shirabe-2b51554ff59d1e5cbf8dd2db65d278b0202a9102.zip | |
refactor: fix compiler warnings and clippy warnings
Diffstat (limited to 'crates/shirabe-external-packages/src/symfony/process/process.rs')
| -rw-r--r-- | crates/shirabe-external-packages/src/symfony/process/process.rs | 71 |
1 files changed, 34 insertions, 37 deletions
diff --git a/crates/shirabe-external-packages/src/symfony/process/process.rs b/crates/shirabe-external-packages/src/symfony/process/process.rs index 1b58972..fbf2da7 100644 --- a/crates/shirabe-external-packages/src/symfony/process/process.rs +++ b/crates/shirabe-external-packages/src/symfony/process/process.rs @@ -1045,28 +1045,26 @@ impl Process { return Ok(()); } - if let Some(timeout) = self.timeout { - if timeout < php::microtime() - self.starttime.unwrap_or(0.0) { - self.stop(0.0, None); + if let Some(timeout) = self.timeout + && timeout < php::microtime() - self.starttime.unwrap_or(0.0) + { + self.stop(0.0, None); - return Err(ProcessTimedOutException::new( - self, - ProcessTimedOutException::TYPE_GENERAL, - ) - .into()); - } + return Err(ProcessTimedOutException::new( + self, + ProcessTimedOutException::TYPE_GENERAL, + ) + .into()); } - if let Some(idle_timeout) = self.idle_timeout { - if idle_timeout < php::microtime() - self.last_output_time.unwrap_or(0.0) { - self.stop(0.0, None); + if let Some(idle_timeout) = self.idle_timeout + && idle_timeout < php::microtime() - self.last_output_time.unwrap_or(0.0) + { + self.stop(0.0, None); - return Err(ProcessTimedOutException::new( - self, - ProcessTimedOutException::TYPE_IDLE, - ) - .into()); - } + return Err( + ProcessTimedOutException::new(self, ProcessTimedOutException::TYPE_IDLE).into(), + ); } Ok(()) @@ -1242,13 +1240,14 @@ impl Process { self.cached_exit_code = exitcode; } - if let Some(cached) = self.cached_exit_code { - if !running && exitcode == Some(-1) { - self.process_information - .as_mut() - .unwrap() - .insert("exitcode".to_string(), PhpMixed::Int(cached)); - } + if let Some(cached) = self.cached_exit_code + && !running + && exitcode == Some(-1) + { + self.process_information + .as_mut() + .unwrap() + .insert("exitcode".to_string(), PhpMixed::Int(cached)); } } @@ -1386,11 +1385,11 @@ impl Process { if signaled && termsig > 0 { // if process has been signaled, no exitcode but a valid termsig, apply Unix convention self.exitcode = Some(128 + termsig); - } else if self.is_sigchild_enabled() { - if let Some(i) = self.process_information.as_mut() { - i.insert("signaled".to_string(), PhpMixed::Bool(true)); - i.insert("termsig".to_string(), PhpMixed::Int(-1)); - } + } else if self.is_sigchild_enabled() + && let Some(i) = self.process_information.as_mut() + { + i.insert("signaled".to_string(), PhpMixed::Bool(true)); + i.insert("termsig".to_string(), PhpMixed::Int(-1)); } } @@ -1659,13 +1658,11 @@ impl Process { key, commandline )) .into()), - Some(v) if matches!(v, PhpMixed::Bool(false)) => { - Err(InvalidArgumentException::new(format!( - "Command line is missing a value for parameter \"{}\": {}", - key, commandline - )) - .into()) - } + Some(PhpMixed::Bool(false)) => Err(InvalidArgumentException::new(format!( + "Command line is missing a value for parameter \"{}\": {}", + key, commandline + )) + .into()), Some(v) => Ok(self.escape_argument(Some(&to_php_string(v)))), } }, |
