From faff529260be05d560f6e9c2fab3eed88b0bd604 Mon Sep 17 00:00:00 2001 From: Eugene P Date: Thu, 10 Jan 2019 12:39:47 +0300 Subject: [PATCH] Show first 12 digits of Hash --- core/src/core/hash.rs | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/core/src/core/hash.rs b/core/src/core/hash.rs index 61a27baa..62170624 100644 --- a/core/src/core/hash.rs +++ b/core/src/core/hash.rs @@ -48,13 +48,9 @@ impl fmt::Debug for Hash { impl fmt::Display for Hash { fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { let hash_hex = self.to_hex(); - let len = hash_hex.len(); - const NUM_SHOW: usize = 8; + const NUM_SHOW: usize = 12; - let starting = &hash_hex[..NUM_SHOW]; - let ending = &hash_hex[(len - NUM_SHOW)..]; - - write!(f, "{}...{}", starting, ending) + write!(f, "{}...", &hash_hex[..NUM_SHOW]) } }