From d3a9327124a66e52ca1114bb8640c02c18c134b8 Mon Sep 17 00:00:00 2001 From: Svyatoslav Nikolsky Date: Wed, 12 Jul 2023 13:34:58 +0300 Subject: [PATCH] reuse Copy trait in hash::clone() (#767) --- fixed-hash/src/hash.rs | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/fixed-hash/src/hash.rs b/fixed-hash/src/hash.rs index 94ea6655..20f3864e 100644 --- a/fixed-hash/src/hash.rs +++ b/fixed-hash/src/hash.rs @@ -258,9 +258,7 @@ macro_rules! construct_fixed_hash { #[cfg_attr(feature = "dev", allow(expl_impl_clone_on_copy))] impl $crate::core_::clone::Clone for $name { fn clone(&self) -> $name { - let mut ret = $name::zero(); - ret.0.copy_from_slice(&self.0); - ret + *self } }