1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
use syn;
use usage::{self, UsesLifetimes, UsesTypeParams};
use {
FromDeriveInput, FromField, FromGenericParam, FromGenerics, FromMeta, FromTypeParam,
FromVariant, Result,
};
#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash, Default)]
pub struct Ignored;
macro_rules! ignored {
($trayt:ident, $method:ident, $syn:path) => {
impl $trayt for Ignored {
fn $method(_: &$syn) -> Result<Self> {
Ok(Ignored)
}
}
};
}
ignored!(FromGenericParam, from_generic_param, syn::GenericParam);
ignored!(FromGenerics, from_generics, syn::Generics);
ignored!(FromTypeParam, from_type_param, syn::TypeParam);
ignored!(FromMeta, from_meta, syn::Meta);
ignored!(FromDeriveInput, from_derive_input, syn::DeriveInput);
ignored!(FromField, from_field, syn::Field);
ignored!(FromVariant, from_variant, syn::Variant);
impl UsesTypeParams for Ignored {
fn uses_type_params<'a>(
&self,
_opts: &usage::Options,
_: &'a usage::IdentSet,
) -> usage::IdentRefSet<'a> {
Default::default()
}
}
impl UsesLifetimes for Ignored {
fn uses_lifetimes<'a>(
&self,
_opts: &usage::Options,
_: &'a usage::LifetimeSet,
) -> usage::LifetimeRefSet<'a> {
Default::default()
}
}