diff --git a/src/libcollections/binary_heap.rs b/src/libcollections/binary_heap.rs index 942115926989..be99c4c0bc72 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 49b66ce25f57..caa2051c3f9c 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 d3790e320ad6..3bf10192e596 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)> { diff --git a/src/libcore/hash/sip.rs b/src/libcore/hash/sip.rs index 15f6768edce5..e10f5a9fed18 100644 --- a/src/libcore/hash/sip.rs +++ b/src/libcore/hash/sip.rs @@ -30,6 +30,7 @@ use default::Default; use super::{Hash, Hasher, Writer}; /// `SipState` computes a SipHash 2-4 hash over a stream of bytes. +#[deriving(Copy)] pub struct SipState { k0: u64, k1: u64, @@ -42,8 +43,6 @@ pub struct SipState { ntail: uint, // how many bytes in tail are valid } -impl Copy for SipState {} - // sadly, these macro definitions can't appear later, // because they're needed in the following defs; // this design could be improved.