replace manual Hash impls with #[deriving(Hash)]
This commit is contained in:
@@ -18,13 +18,12 @@ use str::OwnedStr;
|
|||||||
use container::Container;
|
use container::Container;
|
||||||
use cast;
|
use cast;
|
||||||
use fmt;
|
use fmt;
|
||||||
use hash::{Hash, sip};
|
|
||||||
use iter::Iterator;
|
use iter::Iterator;
|
||||||
use vec::{ImmutableVector, MutableVector, Vector};
|
use vec::{ImmutableVector, MutableVector, Vector};
|
||||||
use option::{Option, Some, None};
|
use option::{Option, Some, None};
|
||||||
|
|
||||||
/// Datatype to hold one ascii character. It wraps a `u8`, with the highest bit always zero.
|
/// Datatype to hold one ascii character. It wraps a `u8`, with the highest bit always zero.
|
||||||
#[deriving(Clone, Eq, Ord, TotalOrd, TotalEq)]
|
#[deriving(Clone, Eq, Ord, TotalOrd, TotalEq, Hash)]
|
||||||
pub struct Ascii { priv chr: u8 }
|
pub struct Ascii { priv chr: u8 }
|
||||||
|
|
||||||
impl Ascii {
|
impl Ascii {
|
||||||
@@ -306,13 +305,6 @@ impl IntoStr for ~[Ascii] {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl Hash for Ascii {
|
|
||||||
#[inline]
|
|
||||||
fn hash(&self, s: &mut sip::SipState) {
|
|
||||||
self.to_byte().hash(s)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/// Trait to convert to an owned byte array by consuming self
|
/// Trait to convert to an owned byte array by consuming self
|
||||||
pub trait IntoBytes {
|
pub trait IntoBytes {
|
||||||
/// Converts to an owned byte array by consuming self
|
/// Converts to an owned byte array by consuming self
|
||||||
|
|||||||
@@ -8,14 +8,13 @@
|
|||||||
// option. This file may not be copied, modified, or distributed
|
// option. This file may not be copied, modified, or distributed
|
||||||
// except according to those terms.
|
// except according to those terms.
|
||||||
|
|
||||||
use std::hash::{Hash, sip};
|
|
||||||
use std::fmt;
|
use std::fmt;
|
||||||
use std::fmt::Show;
|
use std::fmt::Show;
|
||||||
|
|
||||||
#[deriving(Eq)]
|
#[deriving(Eq)]
|
||||||
pub enum Os { OsWin32, OsMacos, OsLinux, OsAndroid, OsFreebsd, }
|
pub enum Os { OsWin32, OsMacos, OsLinux, OsAndroid, OsFreebsd, }
|
||||||
|
|
||||||
#[deriving(Eq)]
|
#[deriving(Eq, Hash)]
|
||||||
pub enum Abi {
|
pub enum Abi {
|
||||||
// NB: This ordering MUST match the AbiDatas array below.
|
// NB: This ordering MUST match the AbiDatas array below.
|
||||||
// (This is ensured by the test indices_are_correct().)
|
// (This is ensured by the test indices_are_correct().)
|
||||||
@@ -267,12 +266,6 @@ impl AbiSet {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl Hash for Abi {
|
|
||||||
fn hash(&self, s: &mut sip::SipState) {
|
|
||||||
self.index().hash(s)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
impl fmt::Show for Abi {
|
impl fmt::Show for Abi {
|
||||||
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
|
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
|
||||||
self.data().name.fmt(f)
|
self.data().name.fmt(f)
|
||||||
|
|||||||
Reference in New Issue
Block a user