Use Ident for project
This commit is contained in:
parent
74b6419bb6
commit
cdbae16516
@ -1,10 +1,10 @@
|
||||
use synstructure;
|
||||
use syn::{self, Meta, NestedMeta};
|
||||
use proc_macro2::{self, Ident, Span};
|
||||
use proc_macro2::{self, Ident};
|
||||
|
||||
struct Attributes {
|
||||
ignore: bool,
|
||||
project: Option<String>,
|
||||
project: Option<Ident>,
|
||||
}
|
||||
|
||||
fn parse_attributes(field: &syn::Field) -> Attributes {
|
||||
@ -29,7 +29,7 @@ fn parse_attributes(field: &syn::Field) -> Attributes {
|
||||
if let Meta::List(list) = meta {
|
||||
if let Some(nested) = list.nested.iter().next() {
|
||||
if let NestedMeta::Meta(meta) = nested {
|
||||
attrs.project = Some(meta.name().to_string());
|
||||
attrs.project = Some(meta.name());
|
||||
any_attr = true;
|
||||
}
|
||||
}
|
||||
@ -55,7 +55,6 @@ pub fn hash_stable_derive(mut s: synstructure::Structure) -> proc_macro2::TokenS
|
||||
if attrs.ignore {
|
||||
quote!{}
|
||||
} else if let Some(project) = attrs.project {
|
||||
let project = Ident::new(&project, Span::call_site());
|
||||
quote!{
|
||||
&#bi.#project.hash_stable(__hcx, __hasher);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user