Remove redundant clones (#31685)
* broadcast_stage remove redundant clone * broadcast_fake_shreds_run remove redundant clone * wallet remove redundant clone * cluster_query remove redundant clone * accounts remove redundant clones
This commit is contained in:
parent
02ac8a46d6
commit
5448d0b1e8
|
@ -1109,7 +1109,7 @@ pub fn process_get_epoch_info(rpc_client: &RpcClient, config: &CliConfig) -> Pro
|
|||
match config.output_format {
|
||||
OutputFormat::Json | OutputFormat::JsonCompact => {}
|
||||
_ => {
|
||||
let epoch_info = cli_epoch_info.epoch_info.clone();
|
||||
let epoch_info = &cli_epoch_info.epoch_info;
|
||||
let average_slot_time_ms = rpc_client
|
||||
.get_recent_performance_samples(Some(60))
|
||||
.ok()
|
||||
|
|
|
@ -651,7 +651,7 @@ pub fn process_show_account(
|
|||
use_lamports_unit: bool,
|
||||
) -> ProcessResult {
|
||||
let account = rpc_client.get_account(account_pubkey)?;
|
||||
let data = account.data.clone();
|
||||
let data = &account.data;
|
||||
let cli_account = CliAccount::new(account_pubkey, &account, use_lamports_unit);
|
||||
|
||||
let mut account_string = config.output_format.formatted_string(&cli_account);
|
||||
|
@ -668,7 +668,7 @@ pub fn process_show_account(
|
|||
OutputFormat::Display | OutputFormat::DisplayVerbose => {
|
||||
if let Some(output_file) = output_file {
|
||||
let mut f = File::create(output_file)?;
|
||||
f.write_all(&data)?;
|
||||
f.write_all(data)?;
|
||||
writeln!(&mut account_string)?;
|
||||
writeln!(&mut account_string, "Wrote account data to {output_file}")?;
|
||||
} else if !data.is_empty() {
|
||||
|
|
|
@ -651,7 +651,7 @@ pub mod test {
|
|||
let ticks_per_slot;
|
||||
let slot;
|
||||
{
|
||||
let bank = broadcast_service.bank.clone();
|
||||
let bank = broadcast_service.bank;
|
||||
start_tick_height = bank.tick_height();
|
||||
max_tick_height = bank.max_tick_height();
|
||||
ticks_per_slot = bank.ticks_per_slot();
|
||||
|
|
|
@ -37,7 +37,7 @@ impl BroadcastRun for BroadcastFakeShredsRun {
|
|||
) -> Result<()> {
|
||||
// 1) Pull entries from banking stage
|
||||
let receive_results = broadcast_utils::recv_slot_entries(receiver)?;
|
||||
let bank = receive_results.bank.clone();
|
||||
let bank = receive_results.bank;
|
||||
let last_tick_height = receive_results.last_tick_height;
|
||||
|
||||
let next_shred_index = blockstore
|
||||
|
|
|
@ -2977,10 +2977,7 @@ mod tests {
|
|||
let counter_clone = counter.clone();
|
||||
let accounts_clone = accounts_arc.clone();
|
||||
let exit_clone = exit.clone();
|
||||
thread::spawn(move || {
|
||||
let counter_clone = counter_clone.clone();
|
||||
let exit_clone = exit_clone.clone();
|
||||
loop {
|
||||
thread::spawn(move || loop {
|
||||
let txs = vec![writable_tx.clone()];
|
||||
let results = accounts_clone
|
||||
.clone()
|
||||
|
@ -2994,7 +2991,6 @@ mod tests {
|
|||
if exit_clone.clone().load(Ordering::Relaxed) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
});
|
||||
let counter_clone = counter;
|
||||
for _ in 0..5 {
|
||||
|
|
Loading…
Reference in New Issue