aboutsummaryrefslogtreecommitdiff
path: root/alacritty_config_derive/src/config_deserialize/de_enum.rs
diff options
context:
space:
mode:
authorKirill Chibisov <contact@kchibisov.com>2023-05-16 08:57:39 +0300
committerKirill Chibisov <contact@kchibisov.com>2023-05-17 08:36:41 +0300
commit6f6ad2b2eec9dbc9b3a1b0190d4a2dfd3c0b3bf6 (patch)
tree7bf2ac2542e2c4c601fc085d021e44601d8260b0 /alacritty_config_derive/src/config_deserialize/de_enum.rs
parent04811c674ba01a0f68d9842c33816b78fe3253ab (diff)
downloadalacritty-6f6ad2b2eec9dbc9b3a1b0190d4a2dfd3c0b3bf6.tar.gz
alacritty-6f6ad2b2eec9dbc9b3a1b0190d4a2dfd3c0b3bf6.zip
Update clap to v4.2.7
Fixes #6879. Fixes #6874.
Diffstat (limited to 'alacritty_config_derive/src/config_deserialize/de_enum.rs')
-rw-r--r--alacritty_config_derive/src/config_deserialize/de_enum.rs10
1 files changed, 9 insertions, 1 deletions
diff --git a/alacritty_config_derive/src/config_deserialize/de_enum.rs b/alacritty_config_derive/src/config_deserialize/de_enum.rs
index 56a2f7ba..f94977ae 100644
--- a/alacritty_config_derive/src/config_deserialize/de_enum.rs
+++ b/alacritty_config_derive/src/config_deserialize/de_enum.rs
@@ -1,6 +1,7 @@
use proc_macro::TokenStream;
use proc_macro2::TokenStream as TokenStream2;
use quote::{format_ident, quote};
+use syn::meta::ParseNestedMeta;
use syn::{DataEnum, Generics, Ident};
use crate::serde_replace;
@@ -14,7 +15,14 @@ pub fn derive_deserialize(ident: Ident, generics: Generics, data_enum: DataEnum)
for variant in data_enum.variants.iter().filter(|variant| {
// Skip deserialization for `#[config(skip)]` fields.
variant.attrs.iter().all(|attr| {
- !crate::path_ends_with(&attr.path, "config") || attr.tokens.to_string() != "(skip)"
+ let is_skip = |meta: ParseNestedMeta| {
+ if meta.path.is_ident("skip") {
+ Ok(())
+ } else {
+ Err(meta.error("not skip"))
+ }
+ };
+ !attr.path().is_ident("config") || attr.parse_nested_meta(is_skip).is_err()
})
}) {
let variant_ident = &variant.ident;