core: Remove the unit module
This commit is contained in:
parent
50331595fc
commit
a0594ebb8b
@ -192,7 +192,23 @@ pub fn max<T: TotalOrd>(v1: T, v2: T) -> T {
|
||||
// Implementation of Eq/TotalEq for some primitive types
|
||||
#[cfg(not(test))]
|
||||
mod impls {
|
||||
use cmp::{Ord, TotalOrd, Eq, TotalEq, Ordering};
|
||||
use cmp::{Ord, TotalOrd, Eq, TotalEq, Ordering, Equal};
|
||||
|
||||
impl Eq for () {
|
||||
#[inline]
|
||||
fn eq(&self, _other: &()) -> bool { true }
|
||||
#[inline]
|
||||
fn ne(&self, _other: &()) -> bool { false }
|
||||
}
|
||||
impl TotalEq for () {}
|
||||
impl Ord for () {
|
||||
#[inline]
|
||||
fn lt(&self, _other: &()) -> bool { false }
|
||||
}
|
||||
impl TotalOrd for () {
|
||||
#[inline]
|
||||
fn cmp(&self, _other: &()) -> Ordering { Equal }
|
||||
}
|
||||
|
||||
// & pointers
|
||||
impl<'a, T: Eq> Eq for &'a T {
|
||||
|
@ -16,6 +16,11 @@ pub trait Default {
|
||||
fn default() -> Self;
|
||||
}
|
||||
|
||||
impl Default for () {
|
||||
#[inline]
|
||||
fn default() -> () { () }
|
||||
}
|
||||
|
||||
impl<T: Default + 'static> Default for @T {
|
||||
fn default() -> @T { @Default::default() }
|
||||
}
|
||||
|
@ -103,7 +103,6 @@ pub mod container;
|
||||
/* Core types and methods on primitives */
|
||||
|
||||
mod unicode;
|
||||
mod unit;
|
||||
pub mod any;
|
||||
pub mod atomics;
|
||||
pub mod bool;
|
||||
|
@ -1,45 +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};
|
||||
|
||||
#[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() -> () { () }
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user