use quote::{ToTokens, quote};
use syn::{Attribute, Meta};
pub(crate) fn generated_impl_attributes(attributes: &[Attribute]) -> proc_macro2::TokenStream {
let mut token_stream = quote!(#[automatically_derived]);
for attribute in attributes {
let path = attribute.path();
if path.is_ident("expect") {
if let Meta::List(list) = &attribute.meta {
let lints = &list.tokens;
token_stream.extend(quote!(#[allow(#lints)]));
}
} else if path.is_ident("allow") || path.is_ident("warn") || path.is_ident("deny") {
attribute.to_tokens(&mut token_stream);
}
}
token_stream
}