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
use proc_macro2::Span;
use syn::Variant;

#[inline]
pub(crate) fn multiple_deref_fields(span: Span) -> syn::Error {
    syn::Error::new(span, "multiple fields are set for `Deref`")
}

#[inline]
pub(crate) fn multiple_deref_fields_of_variant(span: Span, variant: &Variant) -> syn::Error {
    syn::Error::new(
        span,
        format!("multiple fields of the `{}` variant are set for `Deref`", variant.ident),
    )
}

#[inline]
pub(crate) fn no_deref_field(span: Span) -> syn::Error {
    syn::Error::new(span, "there is no field which is assigned for `Deref`")
}

#[inline]
pub(crate) fn no_deref_field_of_variant(span: Span, variant: &Variant) -> syn::Error {
    syn::Error::new(
        span,
        format!(
            "there is no field for the `{}` variant which is assigned for `Deref`",
            variant.ident
        ),
    )
}