diff --git a/crates/always_equal/src/lib.rs b/crates/always_equal/src/lib.rs index 1a5a701..138e6d3 100644 --- a/crates/always_equal/src/lib.rs +++ b/crates/always_equal/src/lib.rs @@ -51,6 +51,46 @@ //! `sizeof::> () == sizeof::` //! _should_ be true. +pub mod prod { + use std::fmt; + + pub struct AlwaysEqual { + inner: T, + } + + impl fmt::Debug for AlwaysEqual { + fn fmt (&self, f: &mut fmt::Formatter) -> fmt::Result { + self.inner.fmt (f) + } + } + + impl fmt::Display for AlwaysEqual { + fn fmt (&self, f: &mut fmt::Formatter) -> fmt::Result { + self.inner.fmt (f) + } + } + + impl AlwaysEqual { + pub fn into_inner (self) -> T { + self.inner + } + } + + impl From for AlwaysEqual { + fn from (inner: T) -> Self { + Self { + inner, + } + } + } + + impl PartialEq for AlwaysEqual { + fn eq (&self, _other: &Self) -> bool { + false + } + } +} + pub mod test { #[derive (Debug)] pub struct AlwaysEqual { @@ -93,46 +133,6 @@ pub mod test { } } -pub mod prod { - use std::fmt; - - pub struct AlwaysEqual { - inner: T, - } - - impl fmt::Debug for AlwaysEqual { - fn fmt (&self, f: &mut fmt::Formatter) -> fmt::Result { - self.inner.fmt (f) - } - } - - impl fmt::Display for AlwaysEqual { - fn fmt (&self, f: &mut fmt::Formatter) -> fmt::Result { - self.inner.fmt (f) - } - } - - impl AlwaysEqual { - pub fn into_inner (self) -> T { - self.inner - } - } - - impl From for AlwaysEqual { - fn from (inner: T) -> Self { - Self { - inner, - } - } - } - - impl PartialEq for AlwaysEqual { - fn eq (&self, _other: &Self) -> bool { - false - } - } -} - #[cfg (test)] mod tests { use std::fs::File;