libcollections: use #[deriving(Copy)]
This commit is contained in:
parent
bd90b936d7
commit
c32a48293a
4 changed files with 7 additions and 15 deletions
|
|
@ -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.
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -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)> {
|
||||
|
|
|
|||
|
|
@ -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.
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue