From 2b51554ff59d1e5cbf8dd2db65d278b0202a9102 Mon Sep 17 00:00:00 2001 From: nsfisis Date: Sat, 27 Jun 2026 03:52:05 +0900 Subject: refactor: fix compiler warnings and clippy warnings --- .../symfony/console/question/choice_question.rs | 6 ++--- .../console/question/confirmation_question.rs | 6 ++--- .../src/symfony/console/question/question.rs | 26 +++++++++++----------- 3 files changed, 19 insertions(+), 19 deletions(-) (limited to 'crates/shirabe-external-packages/src/symfony/console/question') 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>)> { + fn get_autocompleter_callback(&self) -> Option<&dyn Fn(&str) -> Option>> { self.inner.get_autocompleter_callback() } fn get_validator( &self, - ) -> Option<&(dyn Fn(Option) -> Result)> { + ) -> Option<&dyn Fn(Option) -> Result> { 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>)> { + fn get_autocompleter_callback(&self) -> Option<&dyn Fn(&str) -> Option>> { self.inner.get_autocompleter_callback() } fn get_validator( &self, - ) -> Option<&(dyn Fn(Option) -> Result)> { + ) -> Option<&dyn Fn(Option) -> Result> { 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>; - fn get_autocompleter_callback(&self) -> Option<&(dyn Fn(&str) -> Option>)>; + fn get_autocompleter_callback(&self) -> Option<&dyn Fn(&str) -> Option>>; fn get_validator( &self, - ) -> Option<&(dyn Fn(Option) -> Result)>; + ) -> Option<&dyn Fn(Option) -> Result>; fn get_max_attempts(&self) -> Option; - 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 = 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 = 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>)> { + pub fn get_autocompleter_callback(&self) -> Option<&dyn Fn(&str) -> Option>> { 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) -> Result)> { + ) -> Option<&dyn Fn(Option) -> Result> { 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>)> { + fn get_autocompleter_callback(&self) -> Option<&dyn Fn(&str) -> Option>> { self.get_autocompleter_callback() } fn get_validator( &self, - ) -> Option<&(dyn Fn(Option) -> Result)> { + ) -> Option<&dyn Fn(Option) -> Result> { 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() } -- cgit v1.3.1