about summary refs log tree commit diff
path: root/src/libcore
diff options
context:
space:
mode:
authorTobias Bucher <tobiasbucher5991@gmail.com>2015-12-01 23:33:50 +0000
committerTobias Bucher <tobiasbucher5991@gmail.com>2015-12-04 09:16:48 +0000
commit6dff9d03d9fd8d7eed6dc8fedd4c0bc85a3d7478 (patch)
treecf0ab16af808e5552d6b5cde81b4fc091bccca86 /src/libcore
parent7867de02e3daa45d8af4d16a134074d0ebf56d9b (diff)
downloadrust-6dff9d03d9fd8d7eed6dc8fedd4c0bc85a3d7478.tar.gz
rust-6dff9d03d9fd8d7eed6dc8fedd4c0bc85a3d7478.zip
Don't use an explicit temporary for cloning an array
Diffstat (limited to 'src/libcore')
-rw-r--r--src/libcore/array.rs3
1 files changed, 1 insertions, 2 deletions
diff --git a/src/libcore/array.rs b/src/libcore/array.rs
index 06ff6b9d799..97ad99fe0ff 100644
--- a/src/libcore/array.rs
+++ b/src/libcore/array.rs
@@ -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,)*}