aboutsummaryrefslogtreecommitdiffhomepage
path: root/crates/shirabe-external-packages/src/symfony/console/input/input_definition.rs
diff options
context:
space:
mode:
authornsfisis <nsfisis@gmail.com>2026-06-14 14:13:00 +0900
committernsfisis <nsfisis@gmail.com>2026-06-14 14:13:00 +0900
commit430f59c1938b9e5da381365172ab788b54895ffc (patch)
tree180ade07dadc7793a45839f42b5674d62bc5fc00 /crates/shirabe-external-packages/src/symfony/console/input/input_definition.rs
parentba0a7f913b4b2a83d0c8862d657bdc867730a962 (diff)
downloadphp-shirabe-430f59c1938b9e5da381365172ab788b54895ffc.tar.gz
php-shirabe-430f59c1938b9e5da381365172ab788b54895ffc.tar.zst
php-shirabe-430f59c1938b9e5da381365172ab788b54895ffc.zip
refactor: auto-fix clippy warnings
Diffstat (limited to 'crates/shirabe-external-packages/src/symfony/console/input/input_definition.rs')
-rw-r--r--crates/shirabe-external-packages/src/symfony/console/input/input_definition.rs70
1 files changed, 35 insertions, 35 deletions
diff --git a/crates/shirabe-external-packages/src/symfony/console/input/input_definition.rs b/crates/shirabe-external-packages/src/symfony/console/input/input_definition.rs
index 47ce786..390f416 100644
--- a/crates/shirabe-external-packages/src/symfony/console/input/input_definition.rs
+++ b/crates/shirabe-external-packages/src/symfony/console/input/input_definition.rs
@@ -113,18 +113,18 @@ impl InputDefinition {
.into());
}
- if argument.is_required() {
- if let Some(last_optional_argument) = &self.last_optional_argument {
- return Err(LogicException(shirabe_php_shim::LogicException {
- message: format!(
- "Cannot add a required argument \"{}\" after an optional one \"{}\".",
- PhpMixed::String(argument.get_name().to_string()),
- PhpMixed::String(last_optional_argument.get_name().to_string()),
- ),
- code: 0,
- })
- .into());
- }
+ if argument.is_required()
+ && let Some(last_optional_argument) = &self.last_optional_argument
+ {
+ return Err(LogicException(shirabe_php_shim::LogicException {
+ message: format!(
+ "Cannot add a required argument \"{}\" after an optional one \"{}\".",
+ PhpMixed::String(argument.get_name().to_string()),
+ PhpMixed::String(last_optional_argument.get_name().to_string()),
+ ),
+ code: 0,
+ })
+ .into());
}
if argument.is_array() {
@@ -232,17 +232,17 @@ impl InputDefinition {
pub fn add_option(&mut self, option: InputOption) -> anyhow::Result<()> {
let option = Rc::new(option);
- if let Some(existing) = self.options.get(option.get_name()) {
- if !option.equals(existing) {
- return Err(LogicException(shirabe_php_shim::LogicException {
- message: format!(
- "An option named \"{}\" already exists.",
- PhpMixed::String(option.get_name().to_string()),
- ),
- code: 0,
- })
- .into());
- }
+ if let Some(existing) = self.options.get(option.get_name())
+ && !option.equals(existing)
+ {
+ return Err(LogicException(shirabe_php_shim::LogicException {
+ message: format!(
+ "An option named \"{}\" already exists.",
+ PhpMixed::String(option.get_name().to_string()),
+ ),
+ code: 0,
+ })
+ .into());
}
if self.negations.contains_key(option.get_name()) {
return Err(LogicException(shirabe_php_shim::LogicException {
@@ -257,17 +257,17 @@ impl InputDefinition {
if let Some(shortcut) = option.get_shortcut() {
for shortcut in shirabe_php_shim::explode("|", shortcut) {
- if let Some(existing_name) = self.shortcuts.get(&shortcut) {
- if !option.equals(&self.options[existing_name]) {
- return Err(LogicException(shirabe_php_shim::LogicException {
- message: format!(
- "An option with shortcut \"{}\" already exists.",
- PhpMixed::String(shortcut.clone()),
- ),
- code: 0,
- })
- .into());
- }
+ if let Some(existing_name) = self.shortcuts.get(&shortcut)
+ && !option.equals(&self.options[existing_name])
+ {
+ return Err(LogicException(shirabe_php_shim::LogicException {
+ message: format!(
+ "An option with shortcut \"{}\" already exists.",
+ PhpMixed::String(shortcut.clone()),
+ ),
+ code: 0,
+ })
+ .into());
}
}
}
@@ -436,7 +436,7 @@ impl InputDefinition {
}
}
- if elements.len() > 0 && !self.get_arguments().is_empty() {
+ if !elements.is_empty() && !self.get_arguments().is_empty() {
elements.push("[--]".to_string());
}