ez_impl/
dysfunctional.rs

1#![doc(hidden)]
2//! Dysfunctional stub implementations of some traits.
3
4use std::{convert::Infallible, panic::panic_any};
5
6#[derive(Debug, Clone, Copy)]
7/// Drops an iterator without consuming any elements.
8pub struct IteratorDropper;
9impl<Item> FromIterator<Item> for IteratorDropper {
10    fn from_iter<Iterator: IntoIterator<Item = Item>>(_: Iterator) -> Self {
11        IteratorDropper
12    }
13}
14
15/// An uninhabited pseudo-Error-type that panics when any other error types to
16/// convert into it.
17#[derive(Debug, Copy, Clone, PartialEq, Eq, Hash, Ord, PartialOrd)]
18pub struct ErrorPanicker(Infallible);
19
20#[allow(clippy::fallible_impl_from)]
21impl<T> From<T> for ErrorPanicker
22where
23    T: Into<eyre::Report>,
24{
25    fn from(t: T) -> Self {
26        panic_any(t.into())
27    }
28}