diff options
| author | Alex Crichton <alex@alexcrichton.com> | 2014-04-30 20:50:56 -0700 |
|---|---|---|
| committer | Alex Crichton <alex@alexcrichton.com> | 2014-05-07 08:13:56 -0700 |
| commit | e7eed5f670e8b283e7afcba5c79b3b208167a647 (patch) | |
| tree | dade375ba844b0ab532649ca792cb1fff07c28ca /src/libstd | |
| parent | dfd967f239a079cf90f45bfc3d827547e6fe9008 (diff) | |
| download | rust-e7eed5f670e8b283e7afcba5c79b3b208167a647.tar.gz rust-e7eed5f670e8b283e7afcba5c79b3b208167a647.zip | |
core: Inherit the unit module
Diffstat (limited to 'src/libstd')
| -rw-r--r-- | src/libstd/fmt/mod.rs | 6 | ||||
| -rw-r--r-- | src/libstd/lib.rs | 1 | ||||
| -rw-r--r-- | src/libstd/unit.rs | 52 |
3 files changed, 6 insertions, 53 deletions
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 <LICENSE-APACHE or -// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license -// <LICENSE-MIT or http://opensource.org/licenses/MIT>, 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("()") - } -} |
