From 6dff9d03d9fd8d7eed6dc8fedd4c0bc85a3d7478 Mon Sep 17 00:00:00 2001 From: Tobias Bucher Date: Tue, 1 Dec 2015 23:33:50 +0000 Subject: [PATCH] Don't use an explicit temporary for cloning an array --- src/libcore/array.rs | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/libcore/array.rs b/src/libcore/array.rs index 06ff6b9d799f3..97ad99fe0ffa3 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 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,)*}