From dc9cc7aaa6d7d133fd840bd2d03282b75f05ad62 Mon Sep 17 00:00:00 2001 From: naskya Date: Tue, 16 Jul 2024 11:08:10 +0900 Subject: [PATCH] refactor: remove redundant code --- crates/relax-macros/src/lib.rs | 19 +------------------ 1 file changed, 1 insertion(+), 18 deletions(-) diff --git a/crates/relax-macros/src/lib.rs b/crates/relax-macros/src/lib.rs index 4c715fa..7ab1639 100644 --- a/crates/relax-macros/src/lib.rs +++ b/crates/relax-macros/src/lib.rs @@ -11,24 +11,7 @@ fn derive_impl(input: syn::DeriveInput) -> syn::Result { let orig_attrs: Vec = input.attrs.clone().into_iter().collect(); let relax_attrs: Vec<&syn::Attribute> = orig_attrs .iter() - .filter(|attr| { - if let syn::Attribute { - meta: - syn::Meta::List(syn::MetaList { - path: syn::Path { segments, .. }, - .. - }), - .. - } = attr - { - if segments.len() != 1 { - return false; - } - matches!(&segments[0], syn::PathSegment { ident, .. } if ident == "relax") - } else { - false - } - }) + .filter(|attr| attr.path().is_ident("relax")) .collect(); if relax_attrs.is_empty() {