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/console/input | |
| 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/console/input')
4 files changed, 33 insertions, 50 deletions
diff --git a/crates/shirabe-external-packages/src/symfony/console/input/argv_input.rs b/crates/shirabe-external-packages/src/symfony/console/input/argv_input.rs index 54a5f3a..c1a708a 100644 --- a/crates/shirabe-external-packages/src/symfony/console/input/argv_input.rs +++ b/crates/shirabe-external-packages/src/symfony/console/input/argv_input.rs @@ -270,10 +270,10 @@ impl ArgvInput { format!( "No arguments expected for \"{}\" command, got \"{}\".", symfony_command_name.clone().unwrap(), - token.to_string(), + token, ) } else { - format!("No arguments expected, got \"{}\".", token.to_string()) + format!("No arguments expected, got \"{}\".", token) }; return Err( @@ -288,7 +288,7 @@ impl ArgvInput { fn add_short_option(&mut self, shortcut: &str, value: PhpMixed) -> anyhow::Result<()> { if !self.inner.definition.has_shortcut(shortcut) { return Err(RuntimeException(shirabe_php_shim::RuntimeException { - message: format!("The \"-{}\" option does not exist.", shortcut.to_string()), + message: format!("The \"-{}\" option does not exist.", shortcut), code: 0, }) .into()); @@ -308,7 +308,7 @@ impl ArgvInput { if !self.inner.definition.has_option(name) { if !self.inner.definition.has_negation(name) { return Err(RuntimeException(shirabe_php_shim::RuntimeException { - message: format!("The \"--{}\" option does not exist.", name.to_string()), + message: format!("The \"--{}\" option does not exist.", name), code: 0, }) .into()); @@ -317,10 +317,7 @@ impl ArgvInput { let option_name = self.inner.definition.negation_to_name(name)?; if !matches!(value, PhpMixed::Null) { return Err(RuntimeException(shirabe_php_shim::RuntimeException { - message: format!( - "The \"--{}\" option does not accept a value.", - name.to_string(), - ), + message: format!("The \"--{}\" option does not accept a value.", name,), code: 0, }) .into()); @@ -336,10 +333,7 @@ impl ArgvInput { if !matches!(value, PhpMixed::Null) && !option.accept_value() { return Err(RuntimeException(shirabe_php_shim::RuntimeException { - message: format!( - "The \"--{}\" option does not accept a value.", - name.to_string(), - ), + message: format!("The \"--{}\" option does not accept a value.", name,), code: 0, }) .into()); @@ -364,7 +358,7 @@ impl ArgvInput { if matches!(value, PhpMixed::Null) { if option.is_value_required() { return Err(RuntimeException(shirabe_php_shim::RuntimeException { - message: format!("The \"--{}\" option requires a value.", name.to_string()), + message: format!("The \"--{}\" option requires a value.", name), code: 0, }) .into()); diff --git a/crates/shirabe-external-packages/src/symfony/console/input/array_input.rs b/crates/shirabe-external-packages/src/symfony/console/input/array_input.rs index 384bc6d..051d8bd 100644 --- a/crates/shirabe-external-packages/src/symfony/console/input/array_input.rs +++ b/crates/shirabe-external-packages/src/symfony/console/input/array_input.rs @@ -216,7 +216,7 @@ impl ArrayInput { if !self.inner.definition.has_shortcut(shortcut) { return Err(InvalidOptionException(InvalidArgumentException( shirabe_php_shim::InvalidArgumentException { - message: format!("The \"-{}\" option does not exist.", shortcut.to_string()), + message: format!("The \"-{}\" option does not exist.", shortcut), code: 0, }, )) @@ -238,7 +238,7 @@ impl ArrayInput { if !self.inner.definition.has_negation(name) { return Err(InvalidOptionException(InvalidArgumentException( shirabe_php_shim::InvalidArgumentException { - message: format!("The \"--{}\" option does not exist.", name.to_string()), + message: format!("The \"--{}\" option does not exist.", name), code: 0, }, )) @@ -257,18 +257,13 @@ impl ArrayInput { if matches!(value, PhpMixed::Null) { if option.is_value_required() { - return Err( - InvalidOptionException(InvalidArgumentException( - shirabe_php_shim::InvalidArgumentException { - message: format!( - "The \"--{}\" option requires a value.", - name.to_string(), - ), - code: 0, - }, - )) - .into(), - ); + return Err(InvalidOptionException(InvalidArgumentException( + shirabe_php_shim::InvalidArgumentException { + message: format!("The \"--{}\" option requires a value.", name,), + code: 0, + }, + )) + .into()); } if !option.is_value_optional() { diff --git a/crates/shirabe-external-packages/src/symfony/console/input/input.rs b/crates/shirabe-external-packages/src/symfony/console/input/input.rs index 5e5a12b..70b6185 100644 --- a/crates/shirabe-external-packages/src/symfony/console/input/input.rs +++ b/crates/shirabe-external-packages/src/symfony/console/input/input.rs @@ -115,7 +115,7 @@ impl Input { { return Err( InvalidArgumentException(shirabe_php_shim::InvalidArgumentException { - message: format!("The \"{}\" argument does not exist.", name.to_string()), + message: format!("The \"{}\" argument does not exist.", name), code: 0, }) .into(), @@ -139,7 +139,7 @@ impl Input { { return Err( InvalidArgumentException(shirabe_php_shim::InvalidArgumentException { - message: format!("The \"{}\" argument does not exist.", name.to_string()), + message: format!("The \"{}\" argument does not exist.", name), code: 0, }) .into(), @@ -176,7 +176,7 @@ impl Input { if !self.definition.has_option(name) { return Err( InvalidArgumentException(shirabe_php_shim::InvalidArgumentException { - message: format!("The \"{}\" option does not exist.", name.to_string()), + message: format!("The \"{}\" option does not exist.", name), code: 0, }) .into(), @@ -200,7 +200,7 @@ impl Input { } else if !self.definition.has_option(name) { return Err( InvalidArgumentException(shirabe_php_shim::InvalidArgumentException { - message: format!("The \"{}\" option does not exist.", name.to_string()), + message: format!("The \"{}\" option does not exist.", name), code: 0, }) .into(), 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 56f685c..a1d3d30 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 @@ -114,7 +114,7 @@ impl InputDefinition { return Err(LogicException(shirabe_php_shim::LogicException { message: format!( "An argument with name \"{}\" already exists.", - argument.get_name().to_string(), + argument.get_name(), ), code: 0, }) @@ -125,8 +125,8 @@ impl InputDefinition { return Err(LogicException(shirabe_php_shim::LogicException { message: format!( "Cannot add a required argument \"{}\" after an array argument \"{}\".", - argument.get_name().to_string(), - last_array_argument.get_name().to_string(), + argument.get_name(), + last_array_argument.get_name(), ), code: 0, }) @@ -139,8 +139,8 @@ impl InputDefinition { return Err(LogicException(shirabe_php_shim::LogicException { message: format!( "Cannot add a required argument \"{}\" after an optional one \"{}\".", - argument.get_name().to_string(), - last_optional_argument.get_name().to_string(), + argument.get_name(), + last_optional_argument.get_name(), ), code: 0, }) @@ -260,20 +260,14 @@ impl InputDefinition { && !option.equals(existing) { return Err(LogicException(shirabe_php_shim::LogicException { - message: format!( - "An option named \"{}\" already exists.", - option.get_name().to_string(), - ), + message: format!("An option named \"{}\" already exists.", option.get_name(),), code: 0, }) .into()); } if self.negations.contains_key(option.get_name()) { return Err(LogicException(shirabe_php_shim::LogicException { - message: format!( - "An option named \"{}\" already exists.", - option.get_name().to_string(), - ), + message: format!("An option named \"{}\" already exists.", option.get_name(),), code: 0, }) .into()); @@ -329,7 +323,7 @@ impl InputDefinition { if !self.has_option(name) { return Err( InvalidArgumentException(shirabe_php_shim::InvalidArgumentException { - message: format!("The \"--{}\" option does not exist.", name.to_string()), + message: format!("The \"--{}\" option does not exist.", name), code: 0, }) .into(), @@ -381,7 +375,7 @@ impl InputDefinition { match self.shortcuts.get(shortcut) { None => Err( InvalidArgumentException(shirabe_php_shim::InvalidArgumentException { - message: format!("The \"-{}\" option does not exist.", shortcut.to_string()), + message: format!("The \"-{}\" option does not exist.", shortcut), code: 0, }) .into(), @@ -395,7 +389,7 @@ impl InputDefinition { match self.negations.get(negation) { None => Err( InvalidArgumentException(shirabe_php_shim::InvalidArgumentException { - message: format!("The \"--{}\" option does not exist.", negation.to_string()), + message: format!("The \"--{}\" option does not exist.", negation), code: 0, }) .into(), @@ -432,19 +426,19 @@ impl InputDefinition { let shortcut = match option.get_shortcut() { Some(shortcut) => { - format!("-{}|", shortcut.to_string()) + format!("-{}|", shortcut) } None => String::new(), }; let negation = if option.is_negatable() { - format!("|--no-{}", option.get_name().to_string()) + format!("|--no-{}", option.get_name()) } else { String::new() }; elements.push(format!( "[{}--{}{}{}]", shortcut, - option.get_name().to_string(), + option.get_name(), value, negation, )); |
