Skip to content

Commit a0594eb

Browse files
brsonalexcrichton
authored andcommitted
core: Remove the unit module
1 parent 5033159 commit a0594eb

File tree

4 files changed

+22
-47
lines changed

4 files changed

+22
-47
lines changed

src/libcore/cmp.rs

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -192,7 +192,23 @@ pub fn max<T: TotalOrd>(v1: T, v2: T) -> T {
192192
// Implementation of Eq/TotalEq for some primitive types
193193
#[cfg(not(test))]
194194
mod impls {
195-
use cmp::{Ord, TotalOrd, Eq, TotalEq, Ordering};
195+
use cmp::{Ord, TotalOrd, Eq, TotalEq, Ordering, Equal};
196+
197+
impl Eq for () {
198+
#[inline]
199+
fn eq(&self, _other: &()) -> bool { true }
200+
#[inline]
201+
fn ne(&self, _other: &()) -> bool { false }
202+
}
203+
impl TotalEq for () {}
204+
impl Ord for () {
205+
#[inline]
206+
fn lt(&self, _other: &()) -> bool { false }
207+
}
208+
impl TotalOrd for () {
209+
#[inline]
210+
fn cmp(&self, _other: &()) -> Ordering { Equal }
211+
}
196212

197213
// & pointers
198214
impl<'a, T: Eq> Eq for &'a T {

src/libcore/default.rs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,11 @@ pub trait Default {
1616
fn default() -> Self;
1717
}
1818

19+
impl Default for () {
20+
#[inline]
21+
fn default() -> () { () }
22+
}
23+
1924
impl<T: Default + 'static> Default for @T {
2025
fn default() -> @T { @Default::default() }
2126
}

src/libcore/lib.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -103,7 +103,6 @@ pub mod container;
103103
/* Core types and methods on primitives */
104104

105105
mod unicode;
106-
mod unit;
107106
pub mod any;
108107
pub mod atomics;
109108
pub mod bool;

src/libcore/unit.rs

Lines changed: 0 additions & 45 deletions
This file was deleted.

0 commit comments

Comments
 (0)