Skip to content

Commit c280686

Browse files
authored
Remove redundant clone when bundling filled transactions (#12682)
Update simulate.rs
1 parent c4e4b4e commit c280686

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

crates/script/src/simulate.rs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ use futures::future::{join_all, try_join_all};
2323
use parking_lot::RwLock;
2424
use std::{
2525
collections::{BTreeMap, VecDeque},
26+
mem,
2627
sync::Arc,
2728
};
2829

@@ -263,7 +264,7 @@ impl FilledTransactionsState {
263264
/// chain deployment.
264265
///
265266
/// Each transaction will be added with the correct transaction type and gas estimation.
266-
pub async fn bundle(self) -> Result<BundledState> {
267+
pub async fn bundle(mut self) -> Result<BundledState> {
267268
let is_multi_deployment = self.execution_artifacts.rpc_data.total_rpcs.len() > 1;
268269

269270
if is_multi_deployment && !self.build_data.libraries.is_empty() {
@@ -279,7 +280,7 @@ impl FilledTransactionsState {
279280

280281
// Peeking is used to check if the next rpc url is different. If so, it creates a
281282
// [`ScriptSequence`] from all the collected transactions up to this point.
282-
let mut txes_iter = self.transactions.clone().into_iter().peekable();
283+
let mut txes_iter = mem::take(&mut self.transactions).into_iter().peekable();
283284

284285
while let Some(mut tx) = txes_iter.next() {
285286
let tx_rpc = tx.rpc.to_owned();

0 commit comments

Comments
 (0)