From e7eed5f670e8b283e7afcba5c79b3b208167a647 Mon Sep 17 00:00:00 2001 From: Alex Crichton Date: Wed, 30 Apr 2014 20:50:56 -0700 Subject: core: Inherit the unit module --- src/libstd/fmt/mod.rs | 6 ++++++ src/libstd/lib.rs | 1 - src/libstd/unit.rs | 52 --------------------------------------------------- 3 files changed, 6 insertions(+), 53 deletions(-) delete mode 100644 src/libstd/unit.rs (limited to 'src/libstd') diff --git a/src/libstd/fmt/mod.rs b/src/libstd/fmt/mod.rs index 8c999c2e2e3..7623da8734e 100644 --- a/src/libstd/fmt/mod.rs +++ b/src/libstd/fmt/mod.rs @@ -1250,6 +1250,12 @@ impl<'a> Show for &'a any::Any { fn fmt(&self, f: &mut Formatter) -> Result { f.pad("&Any") } } +impl Show for () { + fn fmt(&self, f: &mut Formatter) -> Result { + f.pad("()") + } +} + impl Show for TypeId { fn fmt(&self, f: &mut Formatter) -> Result { write!(f.buf, "TypeId \\{ {} \\}", self.hash()) diff --git a/src/libstd/lib.rs b/src/libstd/lib.rs index ef07fc2f995..5e71fc72dc9 100644 --- a/src/libstd/lib.rs +++ b/src/libstd/lib.rs @@ -190,7 +190,6 @@ pub mod prelude; #[path = "num/f32.rs"] pub mod f32; #[path = "num/f64.rs"] pub mod f64; -pub mod unit; pub mod bool; pub mod tuple; diff --git a/src/libstd/unit.rs b/src/libstd/unit.rs deleted file mode 100644 index 38307f415ac..00000000000 --- a/src/libstd/unit.rs +++ /dev/null @@ -1,52 +0,0 @@ -// Copyright 2012-2013 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -//! Functions for the unit type. - -#[cfg(not(test))] -use default::Default; -#[cfg(not(test))] -use cmp::{Eq, Equal, Ord, Ordering, TotalEq, TotalOrd}; -use fmt; - -#[cfg(not(test))] -impl Eq for () { - #[inline] - fn eq(&self, _other: &()) -> bool { true } - #[inline] - fn ne(&self, _other: &()) -> bool { false } -} - -#[cfg(not(test))] -impl Ord for () { - #[inline] - fn lt(&self, _other: &()) -> bool { false } -} - -#[cfg(not(test))] -impl TotalOrd for () { - #[inline] - fn cmp(&self, _other: &()) -> Ordering { Equal } -} - -#[cfg(not(test))] -impl TotalEq for () {} - -#[cfg(not(test))] -impl Default for () { - #[inline] - fn default() -> () { () } -} - -impl fmt::Show for () { - fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { - f.pad("()") - } -} -- cgit 1.4.1-3-g733a5