Skip to content

Commit fa5762c

Browse files
authored
refactor: remove redundant clone calls (#3258)
Remove unnecessary `.clone()` calls where variables are not used after the clone, allowing direct ownership transfer instead of copying. Files modified: - examples/contract_deployment/src/main.rs - bins/revme/src/cmd/bench/burntpix.rs - bins/revme/src/cmd/bench/snailtracer.rs - bins/revme/src/cmd/blockchaintest.rs - bins/revme/src/cmd/statetest/runner.rs
1 parent 3b17ee6 commit fa5762c

File tree

5 files changed

+10
-10
lines changed

5 files changed

+10
-10
lines changed

bins/revme/src/cmd/bench/burntpix.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ pub fn run(criterion: &mut Criterion) {
4343
let tx = TxEnv::builder()
4444
.caller(BENCH_CALLER)
4545
.kind(TxKind::Call(BURNTPIX_MAIN_ADDRESS))
46-
.data(run_call_data.clone().into())
46+
.data(run_call_data.into())
4747
.gas_limit(u64::MAX)
4848
.build()
4949
.unwrap();

bins/revme/src/cmd/bench/snailtracer.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ pub fn run(criterion: &mut Criterion) {
1313
let bytecode = Bytecode::new_raw(Bytes::from(hex::decode(BYTES).unwrap()));
1414

1515
let mut evm = Context::mainnet()
16-
.with_db(BenchmarkDB::new_bytecode(bytecode.clone()))
16+
.with_db(BenchmarkDB::new_bytecode(bytecode))
1717
.modify_cfg_chained(|c| c.disable_nonce_check = true)
1818
.build_mainnet()
1919
.with_inspector(NoOpInspector {});

bins/revme/src/cmd/blockchaintest.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -268,7 +268,7 @@ fn run_test_file(
268268
println!("{}", serde_json::to_string(&output).unwrap());
269269
}
270270
return Err(Error::TestExecution {
271-
test_name: test_name.clone(),
271+
test_name,
272272
test_path: file_path.to_path_buf(),
273273
error: e.to_string(),
274274
});

bins/revme/src/cmd/statetest/runner.rs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -361,8 +361,8 @@ pub fn execute_test_suite(
361361
Err(_) if test.expect_exception.is_some() => continue,
362362
Err(_) => {
363363
return Err(TestError {
364-
name: name.clone(),
365-
path: path.clone(),
364+
name,
365+
path,
366366
kind: TestErrorKind::UnknownPrivateKey(unit.transaction.secret_key),
367367
});
368368
}
@@ -387,8 +387,8 @@ pub fn execute_test_suite(
387387
static FAILED: AtomicBool = AtomicBool::new(false);
388388
if print_json_outcome || FAILED.swap(true, Ordering::SeqCst) {
389389
return Err(TestError {
390-
name: name.clone(),
391-
path: path.clone(),
390+
name,
391+
path,
392392
kind: e,
393393
});
394394
}
@@ -407,8 +407,8 @@ pub fn execute_test_suite(
407407
});
408408

409409
return Err(TestError {
410-
path: path.clone(),
411-
name: name.clone(),
410+
path,
411+
name,
412412
kind: e,
413413
});
414414
}

examples/contract_deployment/src/main.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ fn main() -> anyhow::Result<()> {
5555
let ref_tx = evm.transact_commit(
5656
TxEnv::builder()
5757
.kind(TxKind::Create)
58-
.data(bytecode.clone())
58+
.data(bytecode)
5959
.build()
6060
.unwrap(),
6161
)?;

0 commit comments

Comments
 (0)