diff --git a/serde_valid/src/lib.rs b/serde_valid/src/lib.rs index 992cf3b..5b2c4d9 100644 --- a/serde_valid/src/lib.rs +++ b/serde_valid/src/lib.rs @@ -567,6 +567,7 @@ pub mod export { #[cfg(feature = "fluent")] pub use fluent; pub use once_cell; + pub use regex; } pub trait Validate { diff --git a/serde_valid/tests/nested_struct_test.rs b/serde_valid/tests/nested_struct_test.rs index 53b1a3b..3b9320f 100644 --- a/serde_valid/tests/nested_struct_test.rs +++ b/serde_valid/tests/nested_struct_test.rs @@ -135,7 +135,7 @@ fn nested_validate_err_message() { }; assert_eq!( - serde_json::to_value(&s.validate().unwrap_err()).unwrap(), + serde_json::to_value(s.validate().unwrap_err()).unwrap(), json!({ "errors": [], "properties": { diff --git a/serde_valid_derive/src/attribute/common/lit.rs b/serde_valid_derive/src/attribute/common/lit.rs index 01276cf..0cca56a 100644 --- a/serde_valid_derive/src/attribute/common/lit.rs +++ b/serde_valid_derive/src/attribute/common/lit.rs @@ -6,7 +6,7 @@ pub enum LitNumeric<'a> { Float(&'a syn::LitFloat), } -impl<'a> ToTokens for LitNumeric<'a> { +impl ToTokens for LitNumeric<'_> { fn to_tokens(&self, tokens: &mut TokenStream) { match self { LitNumeric::Int(lin) => lin.to_tokens(tokens), diff --git a/serde_valid_derive/src/attribute/field_validate/string/pattern.rs b/serde_valid_derive/src/attribute/field_validate/string/pattern.rs index c0af324..cff64d7 100644 --- a/serde_valid_derive/src/attribute/field_validate/string/pattern.rs +++ b/serde_valid_derive/src/attribute/field_validate/string/pattern.rs @@ -33,8 +33,8 @@ fn inner_extract_string_pattern_validator( ); Ok(quote!( - static #pattern_ident : ::serde_valid::export::once_cell::sync::OnceCell<::regex::Regex> = ::serde_valid::export::once_cell::sync::OnceCell::new(); - let __pattern = #pattern_ident.get_or_init(|| ::regex::Regex::new(#pattern).unwrap()); + static #pattern_ident : ::serde_valid::export::once_cell::sync::OnceCell<::serde_valid::export::regex::Regex> = ::serde_valid::export::once_cell::sync::OnceCell::new(); + let __pattern = #pattern_ident.get_or_init(|| ::serde_valid::export::regex::Regex::new(#pattern).unwrap()); if let Err(__composited_error_params) = ::serde_valid::validation::ValidateCompositedPattern::validate_composited_pattern( #field_ident, __pattern, diff --git a/serde_valid_derive/src/types/field/named.rs b/serde_valid_derive/src/types/field/named.rs index 8eeeb3c..1ccbd22 100644 --- a/serde_valid_derive/src/types/field/named.rs +++ b/serde_valid_derive/src/types/field/named.rs @@ -22,7 +22,7 @@ impl<'a> NamedField<'a> { } } -impl<'a> Field for NamedField<'a> { +impl Field for NamedField<'_> { fn name(&self) -> &String { &self.name } diff --git a/serde_valid_derive/src/types/field/unnamed.rs b/serde_valid_derive/src/types/field/unnamed.rs index 15f36a0..53d68bb 100644 --- a/serde_valid_derive/src/types/field/unnamed.rs +++ b/serde_valid_derive/src/types/field/unnamed.rs @@ -27,7 +27,7 @@ impl<'a> UnnamedField<'a> { } } -impl<'a> Field for UnnamedField<'a> { +impl Field for UnnamedField<'_> { fn name(&self) -> &String { &self.name }