Add copies to type params with Copy bound
This commit is contained in:
parent
682bb4144c
commit
eb48c29681
56 changed files with 380 additions and 390 deletions
|
@ -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),
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue