diff options
| author | Andrew Paseltiner <apaseltiner@gmail.com> | 2013-03-22 16:09:20 -0400 |
|---|---|---|
| committer | Andrew Paseltiner <apaseltiner@gmail.com> | 2013-03-23 06:57:30 -0400 |
| commit | 45677eebf286a39c29d9cd789e76ea1cf2d2b1d0 (patch) | |
| tree | 04b5fbbe19377386b540c192fba0568463da46c1 /src/libcore | |
| parent | 2b83defa4a48303db642f38e2a9f24460756721d (diff) | |
| download | rust-45677eebf286a39c29d9cd789e76ea1cf2d2b1d0.tar.gz rust-45677eebf286a39c29d9cd789e76ea1cf2d2b1d0.zip | |
replace impls with `deriving` where applicable
Diffstat (limited to 'src/libcore')
| -rw-r--r-- | src/libcore/pipes.rs | 9 | ||||
| -rw-r--r-- | src/libcore/task/mod.rs | 11 | ||||
| -rw-r--r-- | src/libcore/vec.rs | 7 |
3 files changed, 3 insertions, 24 deletions
diff --git a/src/libcore/pipes.rs b/src/libcore/pipes.rs index 9cf3e4d6114..350a1de629c 100644 --- a/src/libcore/pipes.rs +++ b/src/libcore/pipes.rs @@ -82,7 +82,6 @@ bounded and unbounded protocols allows for less code duplication. */ -use cmp::Eq; use cast::{forget, reinterpret_cast, transmute}; use cell::Cell; use either::{Either, Left, Right}; @@ -103,6 +102,7 @@ macro_rules! move_it ( ) #[doc(hidden)] +#[deriving(Eq)] enum State { Empty, Full, @@ -110,13 +110,6 @@ enum State { Terminated } -impl Eq for State { - fn eq(&self, other: &State) -> bool { - ((*self) as uint) == ((*other) as uint) - } - fn ne(&self, other: &State) -> bool { !(*self).eq(other) } -} - pub struct BufferHeader { // Tracks whether this buffer needs to be freed. We can probably // get away with restricting it to 0 or 1, if we're careful. diff --git a/src/libcore/task/mod.rs b/src/libcore/task/mod.rs index a6646605b75..349a10bb809 100644 --- a/src/libcore/task/mod.rs +++ b/src/libcore/task/mod.rs @@ -72,21 +72,12 @@ pub enum Task { * If you wish for this result's delivery to block until all linked and/or * children tasks complete, recommend using a result future. */ +#[deriving(Eq)] pub enum TaskResult { Success, Failure, } -impl Eq for TaskResult { - fn eq(&self, other: &TaskResult) -> bool { - match ((*self), (*other)) { - (Success, Success) | (Failure, Failure) => true, - (Success, _) | (Failure, _) => false - } - } - fn ne(&self, other: &TaskResult) -> bool { !(*self).eq(other) } -} - /// Scheduler modes #[deriving(Eq)] pub enum SchedMode { diff --git a/src/libcore/vec.rs b/src/libcore/vec.rs index 56d547874d8..a69655cd125 100644 --- a/src/libcore/vec.rs +++ b/src/libcore/vec.rs @@ -2533,12 +2533,7 @@ impl<A:Copy> iter::CopyableNonstrictIter<A> for @[A] { impl<A:Clone> Clone for ~[A] { #[inline] fn clone(&self) -> ~[A] { - let mut dolly = ~[]; - vec::reserve(&mut dolly, self.len()); - for self.each |item| { - dolly.push(item.clone()); - } - return dolly; + self.map(|item| item.clone()) } } |
