Skip to content

Commit 848cbb4

Browse files
committed
replace manual Hash impls with #[deriving(Hash)]
1 parent f12ff19 commit 848cbb4

File tree

2 files changed

+2
-17
lines changed

2 files changed

+2
-17
lines changed

src/libstd/ascii.rs

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -18,13 +18,12 @@ use str::OwnedStr;
1818
use container::Container;
1919
use cast;
2020
use fmt;
21-
use hash::{Hash, sip};
2221
use iter::Iterator;
2322
use vec::{ImmutableVector, MutableVector, Vector};
2423
use option::{Option, Some, None};
2524

2625
/// Datatype to hold one ascii character. It wraps a `u8`, with the highest bit always zero.
27-
#[deriving(Clone, Eq, Ord, TotalOrd, TotalEq)]
26+
#[deriving(Clone, Eq, Ord, TotalOrd, TotalEq, Hash)]
2827
pub struct Ascii { priv chr: u8 }
2928

3029
impl Ascii {
@@ -306,13 +305,6 @@ impl IntoStr for ~[Ascii] {
306305
}
307306
}
308307

309-
impl Hash for Ascii {
310-
#[inline]
311-
fn hash(&self, s: &mut sip::SipState) {
312-
self.to_byte().hash(s)
313-
}
314-
}
315-
316308
/// Trait to convert to an owned byte array by consuming self
317309
pub trait IntoBytes {
318310
/// Converts to an owned byte array by consuming self

src/libsyntax/abi.rs

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -8,14 +8,13 @@
88
// option. This file may not be copied, modified, or distributed
99
// except according to those terms.
1010

11-
use std::hash::{Hash, sip};
1211
use std::fmt;
1312
use std::fmt::Show;
1413

1514
#[deriving(Eq)]
1615
pub enum Os { OsWin32, OsMacos, OsLinux, OsAndroid, OsFreebsd, }
1716

18-
#[deriving(Eq)]
17+
#[deriving(Eq, Hash)]
1918
pub enum Abi {
2019
// NB: This ordering MUST match the AbiDatas array below.
2120
// (This is ensured by the test indices_are_correct().)
@@ -267,12 +266,6 @@ impl AbiSet {
267266
}
268267
}
269268

270-
impl Hash for Abi {
271-
fn hash(&self, s: &mut sip::SipState) {
272-
self.index().hash(s)
273-
}
274-
}
275-
276269
impl fmt::Show for Abi {
277270
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
278271
self.data().name.fmt(f)

0 commit comments

Comments
 (0)