Rename Skip::None to Skip::Never

This commit is contained in:
Sosthène Guédon
2025-06-02 11:03:03 +02:00
parent 0d2c6910ff
commit 432a7a26ed
2 changed files with 6 additions and 6 deletions
+3 -3
View File
@@ -52,7 +52,7 @@ fn serialize_fields(fields: &[parse::Field], offset: usize) -> Vec<proc_macro2::
}
}),
Skip::Always => None,
Skip::None => Some(quote! {
Skip::Never => Some(quote! {
map.serialize_entry(&#index, &self.#member)?;
}),
}
@@ -72,7 +72,7 @@ fn count_serialized_fields(fields: &[parse::Field]) -> Vec<proc_macro2::TokenStr
}
Skip::Always => quote! { 0 },
Skip::None => {
Skip::Never => {
quote! { 1 }
}
}
@@ -133,7 +133,7 @@ fn unwrap_expected_fields(fields: &[parse::Field]) -> Vec<proc_macro2::TokenStre
let label = field.label.clone();
let ident = format_ident!("{}", &field.label);
match field.skip_serializing_if {
Skip::None => quote! {
Skip::Never => quote! {
let #ident = #ident.ok_or_else(|| serde::de::Error::missing_field(#label))?;
},
Skip::If(_) => quote! {
+3 -3
View File
@@ -17,14 +17,14 @@ pub struct StructAttrs {
}
pub enum Skip {
None,
Never,
If(syn::ExprPath),
Always,
}
impl Skip {
pub fn is_none(&self) -> bool {
matches!(self, Self::None)
matches!(self, Self::Never)
}
pub fn is_always(&self) -> bool {
matches!(self, Self::Always)
@@ -114,7 +114,7 @@ fn fields_from_ast(
let current_index = index;
index += 1;
let mut skip_serializing_if = Skip::None;
let mut skip_serializing_if = Skip::Never;
for attr in &field.attrs {
if attr.path().is_ident("serde") {
attr.parse_nested_meta(|meta| {