From 365545b33a4527e834f9dd0c998d78bc602bf7f5 Mon Sep 17 00:00:00 2001 From: kevinheavey Date: Wed, 19 Jun 2024 09:08:00 +0400 Subject: [PATCH] remove join fn --- sdk/program/src/program_stubs.rs | 34 ++++++-------------------------- 1 file changed, 6 insertions(+), 28 deletions(-) diff --git a/sdk/program/src/program_stubs.rs b/sdk/program/src/program_stubs.rs index f5fbeb2a5c1efc..e06f6b1d201a42 100644 --- a/sdk/program/src/program_stubs.rs +++ b/sdk/program/src/program_stubs.rs @@ -8,10 +8,7 @@ use { program_error::UNSUPPORTED_SYSVAR, pubkey::Pubkey, }, base64::{prelude::BASE64_STANDARD, Engine}, - std::{ - fmt::Write, - sync::{Arc, RwLock}, - }, + std::sync::{Arc, RwLock}, }; lazy_static::lazy_static! { @@ -24,29 +21,6 @@ pub fn set_syscall_stubs(syscall_stubs: Box) -> Box(itr: &mut I, sep: &str) -> String -where - I: Iterator, - I::Item: std::fmt::Display, -{ - match itr.next() { - None => String::new(), - Some(first_elt) => { - // estimate lower bound of capacity needed - let (lower, _) = itr.size_hint(); - let mut result = String::with_capacity(sep.len() * lower); - write!(&mut result, "{}", first_elt).unwrap(); - itr.for_each(|elt| { - result.push_str(sep); - write!(&mut result, "{}", elt).unwrap(); - }); - result - } - } -} - #[allow(clippy::arithmetic_side_effects)] pub trait SyscallStubs: Sync + Send { fn sol_log(&self, message: &str) { @@ -139,7 +113,11 @@ pub trait SyscallStubs: Sync + Send { fn sol_log_data(&self, fields: &[&[u8]]) { println!( "data: {}", - fields.iter().map(|v| BASE64_STANDARD.encode(v)).collect::>().join(" ") + fields + .iter() + .map(|v| BASE64_STANDARD.encode(v)) + .collect::>() + .join(" ") ); } fn sol_get_processed_sibling_instruction(&self, _index: usize) -> Option {