From 01db3b6f4ec2df11a9cc85020db66d35f9bcbb52 Mon Sep 17 00:00:00 2001 From: Michael Sproul Date: Mon, 30 Sep 2019 12:32:44 +1000 Subject: [PATCH] Fix SignedRoot macro attribute parsing --- eth2/utils/tree_hash_derive/src/lib.rs | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/eth2/utils/tree_hash_derive/src/lib.rs b/eth2/utils/tree_hash_derive/src/lib.rs index 1e702c53c..e396b4fda 100644 --- a/eth2/utils/tree_hash_derive/src/lib.rs +++ b/eth2/utils/tree_hash_derive/src/lib.rs @@ -2,7 +2,7 @@ extern crate proc_macro; use proc_macro::TokenStream; -use quote::{quote, ToTokens}; +use quote::quote; use syn::{parse_macro_input, DeriveInput}; /// Returns a Vec of `syn::Ident` for each named field in the struct, whilst filtering out fields @@ -130,8 +130,8 @@ fn get_signed_root_named_field_idents(struct_data: &syn::DataStruct) -> Vec<&syn } fn should_skip_signed_root(field: &syn::Field) -> bool { - field - .attrs - .iter() - .any(|attr| attr.into_token_stream().to_string() == "# [ signed_root ( skip_hashing ) ]") + field.attrs.iter().any(|attr| { + attr.path.is_ident("signed_root") + && attr.tts.to_string().replace(" ", "") == "(skip_hashing)" + }) }