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 super::*;

macro_rules! error_wrap {
    ($t:ty => $name:ident) => {
        impl From<$t> for TailwindError {
            fn from(e: $t) -> Self {
                Self { kind: Box::new(TailwindErrorKind::$name(e)), level: DiagnosticLevel::None, file: None, range: None }
            }
        }
    };
    ($($t:ty => $name:ident),+ $(,)?) => (
        $(error_wrap!($t=>$name);)+
    );
}

error_wrap![
    std::io::Error  => IOError,
    std::fmt::Error => FormatError,
];

impl From<Infallible> for TailwindError {
    fn from(_: Infallible) -> Self {
        Self::unreachable()
    }
}

impl From<()> for TailwindError {
    fn from(_: ()) -> Self {
        Self::unreachable()
    }
}