From 54b1172dc895947be633feb74558c71ed8b24a07 Mon Sep 17 00:00:00 2001 From: Deirdre Connolly Date: Wed, 12 Feb 2020 18:54:05 -0500 Subject: [PATCH] Avoid a few heap allocations that aren't strictly needed --- zebra-chain/src/note_encryption.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/zebra-chain/src/note_encryption.rs b/zebra-chain/src/note_encryption.rs index 0186852f3..2cde6d5e4 100644 --- a/zebra-chain/src/note_encryption.rs +++ b/zebra-chain/src/note_encryption.rs @@ -48,8 +48,8 @@ impl fmt::Debug for Memo { // This saves work but if the 'valid utf8 string' is just a // bunch of numbers, it prints them out like // 'Memo("\u{0}\u{0}..")', so. ¯\_(ツ)_/¯ - match String::from_utf8(self.0.to_vec()) { - Ok(memo) => output = memo, + match std::str::from_utf8(&self.0[..]) { + Ok(memo) => output = String::from(memo), _ => output = hex::encode(&self.0[..]), }