Skip to content

Commit

Permalink
Don't use an explicit temporary for cloning an array
Browse files Browse the repository at this point in the history
  • Loading branch information
tbu- committed Dec 4, 2015
1 parent 7867de0 commit 6dff9d0
Showing 1 changed file with 1 addition and 2 deletions.
3 changes: 1 addition & 2 deletions src/libcore/array.rs
Expand Up @@ -209,8 +209,7 @@ macro_rules! array_impl_clone {
#[stable(feature = "rust1", since = "1.0.0")]
impl<T: Clone> Clone for [T; $n] {
fn clone(&self) -> [T; $n] {
let temp = [&self[$i], $(&self[$idx]),*];
[temp[$i].clone(), $(temp[$idx].clone()),*]
[self[$i-$i].clone(), $(self[$i-$idx].clone()),*]
}
}
array_impl_clone!{$i, $($idx,)*}
Expand Down

0 comments on commit 6dff9d0

Please sign in to comment.