diff options
| author | Jorge Aparicio <japaricious@gmail.com> | 2014-12-14 22:26:17 -0500 |
|---|---|---|
| committer | Jorge Aparicio <japaricious@gmail.com> | 2014-12-19 10:43:23 -0500 |
| commit | c32a48293aab01133ed9e131fe452fd8c88ff9de (patch) | |
| tree | d33a9e381569cb745814cb69f6f50f0f2de0486d /src/libcollections | |
| parent | bd90b936d73c0ea2c261cd8e7b9c43764cb2da05 (diff) | |
| download | rust-c32a48293aab01133ed9e131fe452fd8c88ff9de.tar.gz rust-c32a48293aab01133ed9e131fe452fd8c88ff9de.zip | |
libcollections: use `#[deriving(Copy)]`
Diffstat (limited to 'src/libcollections')
| -rw-r--r-- | src/libcollections/binary_heap.rs | 4 | ||||
| -rw-r--r-- | src/libcollections/enum_set.rs | 7 | ||||
| -rw-r--r-- | src/libcollections/slice.rs | 8 |
3 files changed, 6 insertions, 13 deletions
diff --git a/src/libcollections/binary_heap.rs b/src/libcollections/binary_heap.rs index 94211592698..be99c4c0bc7 100644 --- a/src/libcollections/binary_heap.rs +++ b/src/libcollections/binary_heap.rs @@ -29,14 +29,12 @@ //! use std::collections::BinaryHeap; //! use std::uint; //! -//! #[deriving(Eq, PartialEq)] +//! #[deriving(Copy, Eq, PartialEq)] //! struct State { //! cost: uint, //! position: uint //! } //! -//! impl Copy for State {} -//! //! // The priority queue depends on `Ord`. //! // Explicitly implement the trait so the queue becomes a min-heap //! // instead of a max-heap. diff --git a/src/libcollections/enum_set.rs b/src/libcollections/enum_set.rs index 49b66ce25f5..caa2051c3f9 100644 --- a/src/libcollections/enum_set.rs +++ b/src/libcollections/enum_set.rs @@ -301,14 +301,12 @@ mod test { use super::{EnumSet, CLike}; - #[deriving(PartialEq, Show)] + #[deriving(Copy, PartialEq, Show)] #[repr(uint)] enum Foo { A, B, C } - impl Copy for Foo {} - impl CLike for Foo { fn to_uint(&self) -> uint { *self as uint @@ -507,6 +505,7 @@ mod test { #[should_fail] fn test_overflow() { #[allow(dead_code)] + #[deriving(Copy)] #[repr(uint)] enum Bar { V00, V01, V02, V03, V04, V05, V06, V07, V08, V09, @@ -518,8 +517,6 @@ mod test { V60, V61, V62, V63, V64, V65, V66, V67, V68, V69, } - impl Copy for Bar {} - impl CLike for Bar { fn to_uint(&self) -> uint { *self as uint diff --git a/src/libcollections/slice.rs b/src/libcollections/slice.rs index d3790e320ad..3bf10192e59 100644 --- a/src/libcollections/slice.rs +++ b/src/libcollections/slice.rs @@ -91,7 +91,7 @@ use alloc::boxed::Box; use core::borrow::{BorrowFrom, BorrowFromMut, ToOwned}; use core::cmp; use core::iter::{range_step, MultiplicativeIterator}; -use core::kinds::{Copy, Sized}; +use core::kinds::Sized; use core::mem::size_of; use core::mem; use core::ops::FnMut; @@ -177,18 +177,16 @@ impl ElementSwaps { } } +#[deriving(Copy)] enum Direction { Pos, Neg } -impl Copy for Direction {} - /// An `Index` and `Direction` together. +#[deriving(Copy)] struct SizeDirection { size: uint, dir: Direction, } -impl Copy for SizeDirection {} - impl Iterator<(uint, uint)> for ElementSwaps { #[inline] fn next(&mut self) -> Option<(uint, uint)> { |
