use syn::visit::Visit;
use crate::into_wir::{Error, Errors};
pub struct AttributeDisallower {
errors: Vec<Error>,
}
impl AttributeDisallower {
pub fn new() -> Self {
Self { errors: Vec::new() }
}
pub fn into_result(self) -> Result<(), Errors> {
Errors::iter_to_result(self.errors)
}
}
impl Visit<'_> for AttributeDisallower {
fn visit_attribute(&mut self, attribute: &syn::Attribute) {
if let syn::Meta::NameValue(meta) = &attribute.meta {
if meta.path.is_ident("doc") {
return;
}
}
self.errors.push(Error::unsupported_syn_construct(
"Attribute here",
&attribute,
));
}
}