use std::error; use std::fmt; /// Definition of an empty enum. /// /// This is used as the error type in situations where there can't be an error. A `Result` /// can be safely unwrapped and the `unwrap()` may be optimized away entirely. pub enum Never {} impl fmt::Display for Never { fn fmt(&self, _: &mut fmt::Formatter<'_>) -> Result<(), std::fmt::Error> { match *self {} } } impl fmt::Debug for Never { fn fmt(&self, _: &mut fmt::Formatter<'_>) -> Result<(), std::fmt::Error> { match *self {} } } impl error::Error for Never {}