From fe83a20c4da88ecc9f5b4f81d2814d6f9c84ed98 Mon Sep 17 00:00:00 2001 From: Pravdyvy Date: Thu, 4 Dec 2025 14:34:11 +0200 Subject: [PATCH] fix: suggestion 1 --- wallet/src/cli/account.rs | 13 ++++--------- 1 file changed, 4 insertions(+), 9 deletions(-) diff --git a/wallet/src/cli/account.rs b/wallet/src/cli/account.rs index f6bc90a0..da1734e8 100644 --- a/wallet/src/cli/account.rs +++ b/wallet/src/cli/account.rs @@ -179,15 +179,10 @@ impl From for TokedDefinitionAccountView { Self { account_type: "Token definition".to_string(), name: { - let mut name_vec_trim = vec![]; - for ch in value.name { - // Assuming, that name does not have UTF-8 NULL and all zeroes are padding. - if ch == 0 { - break; - } - name_vec_trim.push(ch); - } - String::from_utf8(name_vec_trim).unwrap_or(hex::encode(value.name)) + // Assuming, that name does not have UTF-8 NULL and all zeroes are padding. + let name_trimmed: Vec<_> = + value.name.into_iter().take_while(|ch| *ch != 0).collect(); + String::from_utf8(name_trimmed).unwrap_or(hex::encode(value.name)) }, total_supply: value.total_supply, }