Skip to content

Commit 223e9e5

Browse files
committed
chore: change error fn name.
1 parent 5c6c882 commit 223e9e5

File tree

5 files changed

+18
-18
lines changed

5 files changed

+18
-18
lines changed

serde_valid_derive/src/attribute/field_validate/generic/enumerate.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ fn get_enumerate(meta_list: &syn::MetaList) -> Result<Lits, crate::Errors> {
6363
crate::types::NestedMeta::Lit(lit) => enumerate.push(lit.clone()),
6464
crate::types::NestedMeta::Meta(meta) => errors.push(crate::Error::literal_only(meta)),
6565
crate::types::NestedMeta::Closure(closure) => {
66-
errors.push(crate::Error::closure_not_support(closure))
66+
errors.push(crate::Error::closure_not_supported(closure))
6767
}
6868
}
6969
}

serde_valid_derive/src/attribute/field_validate/meta.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ pub fn extract_field_validator(
2727
syn::Meta::List(list) => inner_extract_field_validator(field, attribute, list, rename_map),
2828
syn::Meta::Path(_) => extract_generic_validate_validator(field, rename_map),
2929
syn::Meta::NameValue(name_value) => {
30-
Err(vec![crate::Error::validate_meta_name_value_not_support(
30+
Err(vec![crate::Error::validate_meta_name_value_not_supported(
3131
name_value,
3232
)])
3333
}
@@ -57,9 +57,9 @@ fn inner_extract_field_validator(
5757
2 => match extract_custom_message_format(&nested[1]) {
5858
Ok(custom_message) => {
5959
if nested[0].path().is_ident("custom") {
60-
errors.push(crate::Error::validate_custom_not_support_custom_message(
61-
&nested[1],
62-
));
60+
errors.push(
61+
crate::Error::validate_custom_does_not_support_custom_message(&nested[1]),
62+
);
6363
None
6464
} else {
6565
Some(custom_message)

serde_valid_derive/src/attribute/struct_validate/meta.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ pub fn extract_struct_validator(attribute: &syn::Attribute) -> Result<Validator,
2424
syn::Meta::Path(_) => Ok(quote!()),
2525
syn::Meta::List(list) => inner_extract_struct_validator(attribute, list),
2626
syn::Meta::NameValue(name_value) => {
27-
Err(vec![crate::Error::validate_meta_name_value_not_support(
27+
Err(vec![crate::Error::validate_meta_name_value_not_supported(
2828
name_value,
2929
)])
3030
}
@@ -52,9 +52,9 @@ fn inner_extract_struct_validator(
5252
2 => match extract_custom_message_format(&nested[1]) {
5353
Ok(custom_message) => {
5454
if nested[0].path().is_ident("custom") {
55-
errors.push(crate::Error::validate_custom_not_support_custom_message(
56-
&nested[1],
57-
));
55+
errors.push(
56+
crate::Error::validate_custom_does_not_support_custom_message(&nested[1]),
57+
);
5858
None
5959
} else {
6060
Some(custom_message)

serde_valid_derive/src/derive.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,11 +12,11 @@ pub fn expand_derive(input: &syn::DeriveInput) -> Result<TokenStream, crate::Err
1212
syn::Data::Struct(syn::DataStruct { ref fields, .. }) => match fields {
1313
syn::Fields::Named(fields) => expand_named_struct_derive(input, fields),
1414
syn::Fields::Unnamed(fields) => expand_unnamed_struct_derive(input, fields),
15-
syn::Fields::Unit => Err(vec![crate::Error::unit_struct_not_support(input)]),
15+
syn::Fields::Unit => Err(vec![crate::Error::unit_struct_not_supported(input)]),
1616
},
1717
syn::Data::Enum(syn::DataEnum { variants, .. }) => {
1818
expand_enum_validate_derive(input, variants)
1919
}
20-
syn::Data::Union(_) => Err(vec![crate::Error::union_not_support(input)]),
20+
syn::Data::Union(_) => Err(vec![crate::Error::union_not_supported(input)]),
2121
}
2222
}

serde_valid_derive/src/error.rs

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -162,14 +162,14 @@ impl Error {
162162
Error::new(span, message)
163163
}
164164

165-
pub fn unit_struct_not_support(input: &syn::DeriveInput) -> Self {
165+
pub fn unit_struct_not_supported(input: &syn::DeriveInput) -> Self {
166166
Self::new(
167167
input.span(),
168168
"#[derive(Validate)] does not support Unit Struct.",
169169
)
170170
}
171171

172-
pub fn union_not_support(input: &syn::DeriveInput) -> Self {
172+
pub fn union_not_supported(input: &syn::DeriveInput) -> Self {
173173
Self::new(input.span(), "#[derive(Validate)] does not support Union.")
174174
}
175175

@@ -225,8 +225,8 @@ impl Error {
225225
)
226226
}
227227

228-
pub fn validate_meta_name_value_not_support(name_value: &syn::MetaNameValue) -> Self {
229-
Self::new(name_value.span(), "#[validate = ???] does not support.")
228+
pub fn validate_meta_name_value_not_supported(name_value: &syn::MetaNameValue) -> Self {
229+
Self::new(name_value.span(), "#[validate = ???] not supported.")
230230
}
231231

232232
pub fn meta_path_validation_need_value(path: &syn::Path, validation_type: &str) -> Self {
@@ -457,10 +457,10 @@ impl Error {
457457
Self::new(lit.span(), "Allow str literal only.")
458458
}
459459

460-
pub fn closure_not_support(closure: &syn::ExprClosure) -> Self {
460+
pub fn closure_not_supported(closure: &syn::ExprClosure) -> Self {
461461
Self::new(
462462
closure.or1_token.span(),
463-
format!("Closure not support. {}", closure.to_token_stream()),
463+
format!("Closure not supported. {}", closure.to_token_stream()),
464464
)
465465
}
466466

@@ -472,7 +472,7 @@ impl Error {
472472
self.0.to_compile_error()
473473
}
474474

475-
pub fn validate_custom_not_support_custom_message(meta: &syn::Meta) -> Self {
475+
pub fn validate_custom_does_not_support_custom_message(meta: &syn::Meta) -> Self {
476476
Self::new(
477477
meta.span(),
478478
"#[validate(custon(...), ???)] does not support custom error message.",

0 commit comments

Comments
 (0)