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/question | |
| 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/question')
3 files changed, 19 insertions, 19 deletions
diff --git a/crates/shirabe-external-packages/src/symfony/console/question/choice_question.rs b/crates/shirabe-external-packages/src/symfony/console/question/choice_question.rs index 6c44966..a8cde91 100644 --- a/crates/shirabe-external-packages/src/symfony/console/question/choice_question.rs +++ b/crates/shirabe-external-packages/src/symfony/console/question/choice_question.rs @@ -265,13 +265,13 @@ impl QuestionInterface for ChoiceQuestion { self.inner.get_autocompleter_values() } - fn get_autocompleter_callback(&self) -> Option<&(dyn Fn(&str) -> Option<Vec<PhpMixed>>)> { + fn get_autocompleter_callback(&self) -> Option<&dyn Fn(&str) -> Option<Vec<PhpMixed>>> { self.inner.get_autocompleter_callback() } fn get_validator( &self, - ) -> Option<&(dyn Fn(Option<PhpMixed>) -> Result<PhpMixed, InvalidArgumentException>)> { + ) -> Option<&dyn Fn(Option<PhpMixed>) -> Result<PhpMixed, InvalidArgumentException>> { self.inner.get_validator() } @@ -279,7 +279,7 @@ impl QuestionInterface for ChoiceQuestion { self.inner.get_max_attempts() } - fn get_normalizer(&self) -> Option<&(dyn Fn(PhpMixed) -> PhpMixed)> { + fn get_normalizer(&self) -> Option<&dyn Fn(PhpMixed) -> PhpMixed> { self.inner.get_normalizer() } diff --git a/crates/shirabe-external-packages/src/symfony/console/question/confirmation_question.rs b/crates/shirabe-external-packages/src/symfony/console/question/confirmation_question.rs index 74039d0..4a05046 100644 --- a/crates/shirabe-external-packages/src/symfony/console/question/confirmation_question.rs +++ b/crates/shirabe-external-packages/src/symfony/console/question/confirmation_question.rs @@ -85,13 +85,13 @@ impl QuestionInterface for ConfirmationQuestion { self.inner.get_autocompleter_values() } - fn get_autocompleter_callback(&self) -> Option<&(dyn Fn(&str) -> Option<Vec<PhpMixed>>)> { + fn get_autocompleter_callback(&self) -> Option<&dyn Fn(&str) -> Option<Vec<PhpMixed>>> { self.inner.get_autocompleter_callback() } fn get_validator( &self, - ) -> Option<&(dyn Fn(Option<PhpMixed>) -> Result<PhpMixed, InvalidArgumentException>)> { + ) -> Option<&dyn Fn(Option<PhpMixed>) -> Result<PhpMixed, InvalidArgumentException>> { self.inner.get_validator() } @@ -99,7 +99,7 @@ impl QuestionInterface for ConfirmationQuestion { self.inner.get_max_attempts() } - fn get_normalizer(&self) -> Option<&(dyn Fn(PhpMixed) -> PhpMixed)> { + fn get_normalizer(&self) -> Option<&dyn Fn(PhpMixed) -> PhpMixed> { self.inner.get_normalizer() } diff --git a/crates/shirabe-external-packages/src/symfony/console/question/question.rs b/crates/shirabe-external-packages/src/symfony/console/question/question.rs index 2ff5f62..a96c315 100644 --- a/crates/shirabe-external-packages/src/symfony/console/question/question.rs +++ b/crates/shirabe-external-packages/src/symfony/console/question/question.rs @@ -26,15 +26,15 @@ pub trait QuestionInterface: std::fmt::Debug { fn get_autocompleter_values(&self) -> Option<Vec<PhpMixed>>; - fn get_autocompleter_callback(&self) -> Option<&(dyn Fn(&str) -> Option<Vec<PhpMixed>>)>; + fn get_autocompleter_callback(&self) -> Option<&dyn Fn(&str) -> Option<Vec<PhpMixed>>>; fn get_validator( &self, - ) -> Option<&(dyn Fn(Option<PhpMixed>) -> Result<PhpMixed, InvalidArgumentException>)>; + ) -> Option<&dyn Fn(Option<PhpMixed>) -> Result<PhpMixed, InvalidArgumentException>>; fn get_max_attempts(&self) -> Option<i64>; - fn get_normalizer(&self) -> Option<&(dyn Fn(PhpMixed) -> PhpMixed)>; + fn get_normalizer(&self) -> Option<&dyn Fn(PhpMixed) -> PhpMixed>; fn is_trimmable(&self) -> bool; @@ -178,13 +178,13 @@ impl Question { // array_merge(array_keys($values), array_values($values)) let mut merged: Vec<PhpMixed> = array.keys().map(|k| PhpMixed::String(k.clone())).collect(); - merged.extend(array.values().map(|v| v.clone())); + merged.extend(array.values().cloned()); merged } else { // array_values($values) match &values { - PhpMixed::List(list) => list.iter().cloned().collect(), - PhpMixed::Array(array) => array.values().map(|v| v.clone()).collect(), + PhpMixed::List(list) => list.to_vec(), + PhpMixed::Array(array) => array.values().cloned().collect(), _ => unreachable!(), } }; @@ -200,7 +200,7 @@ impl Question { // list/array elements, otherwise treat as an empty iterator. let cached: Vec<PhpMixed> = match values { PhpMixed::List(list) => list.into_iter().collect(), - PhpMixed::Array(array) => array.into_values().map(|v| v).collect(), + PhpMixed::Array(array) => array.into_values().collect(), _ => Vec::new(), }; Some(Box::new(move |_input: &str| Some(cached.clone()))) @@ -212,7 +212,7 @@ impl Question { } /// Gets the callback function used for the autocompleter. - pub fn get_autocompleter_callback(&self) -> Option<&(dyn Fn(&str) -> Option<Vec<PhpMixed>>)> { + pub fn get_autocompleter_callback(&self) -> Option<&dyn Fn(&str) -> Option<Vec<PhpMixed>>> { self.autocompleter_callback.as_deref() } @@ -251,7 +251,7 @@ impl Question { /// Gets the validator for the question. pub fn get_validator( &self, - ) -> Option<&(dyn Fn(Option<PhpMixed>) -> Result<PhpMixed, InvalidArgumentException>)> { + ) -> Option<&dyn Fn(Option<PhpMixed>) -> Result<PhpMixed, InvalidArgumentException>> { self.validator.as_deref() } @@ -299,7 +299,7 @@ impl Question { /// Gets the normalizer for the response. /// /// The normalizer can ba a callable (a string), a closure or a class implementing __invoke. - pub fn get_normalizer(&self) -> Option<&(dyn Fn(PhpMixed) -> PhpMixed)> { + pub fn get_normalizer(&self) -> Option<&dyn Fn(PhpMixed) -> PhpMixed> { self.normalizer.as_deref() } @@ -352,13 +352,13 @@ impl QuestionInterface for Question { self.get_autocompleter_values() } - fn get_autocompleter_callback(&self) -> Option<&(dyn Fn(&str) -> Option<Vec<PhpMixed>>)> { + fn get_autocompleter_callback(&self) -> Option<&dyn Fn(&str) -> Option<Vec<PhpMixed>>> { self.get_autocompleter_callback() } fn get_validator( &self, - ) -> Option<&(dyn Fn(Option<PhpMixed>) -> Result<PhpMixed, InvalidArgumentException>)> { + ) -> Option<&dyn Fn(Option<PhpMixed>) -> Result<PhpMixed, InvalidArgumentException>> { self.get_validator() } @@ -366,7 +366,7 @@ impl QuestionInterface for Question { self.get_max_attempts() } - fn get_normalizer(&self) -> Option<&(dyn Fn(PhpMixed) -> PhpMixed)> { + fn get_normalizer(&self) -> Option<&dyn Fn(PhpMixed) -> PhpMixed> { self.get_normalizer() } |
