[][src]Trait macro_compose::Lint

pub trait Lint<I> {
    fn lint(&self, input: &I, c: &mut Collector);
}

Lint is used for linting the macro input

Example

use macro_compose::{Collector, Lint};
use syn::{Data, DeriveInput, Error};

struct EnsureStructLint;

impl Lint<DeriveInput> for EnsureStructLint {
    fn lint(&self, input: &DeriveInput, c: &mut Collector) {
        if !matches!(&input.data, Data::Struct(_)) {
            c.error(Error::new_spanned(input, "expected a struct"));
        }
    }
}

Required methods

fn lint(&self, input: &I, c: &mut Collector)

lint the macro input

Loading content...

Implementors

Loading content...