1
Fork 0

Add copies to type params with Copy bound

This commit is contained in:
Niko Matsakis 2013-06-15 20:26:59 -04:00
parent 682bb4144c
commit eb48c29681
56 changed files with 380 additions and 390 deletions

View file

@ -32,7 +32,7 @@ impl<T:Copy,U:Copy> CopyableTuple<T, U> for (T, U) {
#[inline(always)]
fn first(&self) -> T {
match *self {
(t, _) => t,
(ref t, _) => copy *t,
}
}
@ -40,14 +40,14 @@ impl<T:Copy,U:Copy> CopyableTuple<T, U> for (T, U) {
#[inline(always)]
fn second(&self) -> U {
match *self {
(_, u) => u,
(_, ref u) => copy *u,
}
}
/// Return the results of swapping the two elements of self
#[inline(always)]
fn swap(&self) -> (U, T) {
match *self {
match copy *self {
(t, u) => (u, t),
}
}