♻️ refactor: alphabetize

main
_ 2021-04-17 14:58:51 -05:00
parent eb9e8ed38c
commit e02dbf6e31
1 changed files with 40 additions and 40 deletions

View File

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