Skip to content

Commit c3fc42a

Browse files
authored
Feat: update clippy requirements to nightly-2023-08-24 without changing toolchain (#832)
# Description Currently impossible to update toolchain, it's related to [NEAR issue](near/nearcore#9143). And it is impossible to do `cargo update`, because [issue](rust-cli/anstyle#118 (comment)). - Updated clippy requirements to `nightly-2023-08-24`, without updating `rust-toolchain`. - Fixed clippy issues, related to clippy requirements for `nightly-2023-08-24` version.
1 parent 2d3a4d8 commit c3fc42a

File tree

17 files changed

+48
-42
lines changed

17 files changed

+48
-42
lines changed

engine-hashchain/src/bloom.rs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,10 @@
22
//! Link: <https://github.com/paritytech/parity-common/blob/master/ethbloom/src/lib.rs>
33
//!
44
//! Reimplemented here since there is a large mismatch in types and dependencies.
5-
#![allow(clippy::expl_impl_clone_on_copy)]
5+
#![allow(
6+
clippy::expl_impl_clone_on_copy,
7+
// TODO: rust-2023-08-24 clippy::incorrect_clone_impl_on_copy_type
8+
)]
69

710
use aurora_engine_sdk::keccak;
811
use aurora_engine_types::borsh::{self, BorshDeserialize, BorshSerialize};

engine-precompiles/src/alt_bn256.rs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -189,8 +189,8 @@ impl<HF: HardFork> Bn256Add<HF> {
189189
pub const ADDRESS: Address = make_address(0, 6);
190190

191191
#[must_use]
192-
pub fn new() -> Self {
193-
Self(PhantomData::default())
192+
pub const fn new() -> Self {
193+
Self(PhantomData)
194194
}
195195
}
196196

@@ -294,8 +294,8 @@ impl<HF: HardFork> Bn256Mul<HF> {
294294
pub const ADDRESS: Address = make_address(0, 7);
295295

296296
#[must_use]
297-
pub fn new() -> Self {
298-
Self(PhantomData::default())
297+
pub const fn new() -> Self {
298+
Self(PhantomData)
299299
}
300300
}
301301

@@ -402,8 +402,8 @@ impl<HF: HardFork> Bn256Pair<HF> {
402402
pub const ADDRESS: Address = make_address(0, 8);
403403

404404
#[must_use]
405-
pub fn new() -> Self {
406-
Self(PhantomData::default())
405+
pub const fn new() -> Self {
406+
Self(PhantomData)
407407
}
408408
}
409409

engine-precompiles/src/lib.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -166,7 +166,7 @@ impl<'a, I: IO + Copy, E: Env, H: ReadOnlyPromiseHandler> executor::stack::Preco
166166

167167
fn process_precompile(
168168
p: &dyn Precompile,
169-
handle: &mut impl PrecompileHandle,
169+
handle: &impl PrecompileHandle,
170170
) -> Result<PrecompileOutput, PrecompileFailure> {
171171
let input = handle.input();
172172
let gas_limit = handle.gas_limit();

engine-precompiles/src/modexp.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,8 @@ impl<HF: HardFork, M: ModExpAlgorithm> ModExp<HF, M> {
1414
pub const ADDRESS: Address = make_address(0, 5);
1515

1616
#[must_use]
17-
pub fn new() -> Self {
18-
Self(PhantomData::default(), PhantomData::default())
17+
pub const fn new() -> Self {
18+
Self(PhantomData, PhantomData)
1919
}
2020
}
2121

engine-standalone-storage/src/json_snapshot/mod.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ pub mod types;
55
/// Write engine state directly into the Storage from a
66
/// JSON snapshot (which can be extracted from a NEAR RPC node).
77
pub fn initialize_engine_state(
8-
storage: &mut Storage,
8+
storage: &Storage,
99
snapshot: types::JsonSnapshot,
1010
) -> Result<(), error::Error> {
1111
// The snapshot is giving us a post-state, so we insert it right at the end of its block height.
@@ -64,7 +64,7 @@ mod test {
6464
"contract.aurora.block51077328.json",
6565
)
6666
.unwrap();
67-
let mut storage = crate::Storage::open("rocks_tmp/").unwrap();
68-
super::initialize_engine_state(&mut storage, snapshot).unwrap();
67+
let storage = crate::Storage::open("rocks_tmp/").unwrap();
68+
super::initialize_engine_state(&storage, snapshot).unwrap();
6969
}
7070
}

engine-standalone-tracing/src/sputnik.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -132,7 +132,7 @@ impl evm_runtime::tracing::EventListener for TransactionTraceBuilder {
132132
return_value,
133133
} => {
134134
match result {
135-
Ok(_) => {
135+
Ok(()) => {
136136
// Step completed, push current log into the record
137137
self.logs.push(self.current.clone());
138138
}

engine-tests/src/tests/erc20.rs

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ fn erc20_mint() {
2222
// Validate pre-state
2323
assert_eq!(
2424
U256::zero(),
25-
get_address_erc20_balance(&mut runner, &source_account, dest_address, &contract)
25+
get_address_erc20_balance(&runner, &source_account, dest_address, &contract)
2626
);
2727

2828
// Do mint transaction
@@ -35,7 +35,7 @@ fn erc20_mint() {
3535
// Validate post-state
3636
assert_eq!(
3737
U256::from(mint_amount),
38-
get_address_erc20_balance(&mut runner, &source_account, dest_address, &contract)
38+
get_address_erc20_balance(&runner, &source_account, dest_address, &contract)
3939
);
4040
}
4141

@@ -49,7 +49,7 @@ fn erc20_mint_out_of_gas() {
4949
// Validate pre-state
5050
assert_eq!(
5151
U256::zero(),
52-
get_address_erc20_balance(&mut runner, &source_account, dest_address, &contract)
52+
get_address_erc20_balance(&runner, &source_account, dest_address, &contract)
5353
);
5454

5555
// Try mint transaction
@@ -131,11 +131,11 @@ fn erc20_transfer_success() {
131131
// Validate pre-state
132132
assert_eq!(
133133
U256::from(INITIAL_BALANCE),
134-
get_address_erc20_balance(&mut runner, &source_account, source_address, &contract)
134+
get_address_erc20_balance(&runner, &source_account, source_address, &contract)
135135
);
136136
assert_eq!(
137137
U256::zero(),
138-
get_address_erc20_balance(&mut runner, &source_account, dest_address, &contract)
138+
get_address_erc20_balance(&runner, &source_account, dest_address, &contract)
139139
);
140140

141141
// Do transfer
@@ -149,11 +149,11 @@ fn erc20_transfer_success() {
149149
// Validate post-state
150150
assert_eq!(
151151
U256::from(INITIAL_BALANCE - TRANSFER_AMOUNT),
152-
get_address_erc20_balance(&mut runner, &source_account, source_address, &contract)
152+
get_address_erc20_balance(&runner, &source_account, source_address, &contract)
153153
);
154154
assert_eq!(
155155
U256::from(TRANSFER_AMOUNT),
156-
get_address_erc20_balance(&mut runner, &source_account, dest_address, &contract)
156+
get_address_erc20_balance(&runner, &source_account, dest_address, &contract)
157157
);
158158
}
159159

@@ -170,11 +170,11 @@ fn erc20_transfer_insufficient_balance() {
170170
// Validate pre-state
171171
assert_eq!(
172172
U256::from(INITIAL_BALANCE),
173-
get_address_erc20_balance(&mut runner, &source_account, source_address, &contract)
173+
get_address_erc20_balance(&runner, &source_account, source_address, &contract)
174174
);
175175
assert_eq!(
176176
U256::zero(),
177-
get_address_erc20_balance(&mut runner, &source_account, dest_address, &contract)
177+
get_address_erc20_balance(&runner, &source_account, dest_address, &contract)
178178
);
179179

180180
// Do transfer
@@ -189,11 +189,11 @@ fn erc20_transfer_insufficient_balance() {
189189
// Validate post-state
190190
assert_eq!(
191191
U256::from(INITIAL_BALANCE),
192-
get_address_erc20_balance(&mut runner, &source_account, source_address, &contract)
192+
get_address_erc20_balance(&runner, &source_account, source_address, &contract)
193193
);
194194
assert_eq!(
195195
U256::zero(),
196-
get_address_erc20_balance(&mut runner, &source_account, dest_address, &contract)
196+
get_address_erc20_balance(&runner, &source_account, dest_address, &contract)
197197
);
198198
}
199199

@@ -238,7 +238,7 @@ fn deploy_erc_20_out_of_gas() {
238238
}
239239

240240
fn get_address_erc20_balance(
241-
runner: &mut utils::AuroraRunner,
241+
runner: &utils::AuroraRunner,
242242
signer: &Signer,
243243
address: Address,
244244
contract: &ERC20,

engine-tests/src/tests/repro.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -169,7 +169,7 @@ fn repro_common(context: &ReproContext) {
169169

170170
// Also validate the SubmitResult in the standalone engine
171171
let mut standalone = standalone::StandaloneRunner::default();
172-
json_snapshot::initialize_engine_state(&mut standalone.storage, snapshot).unwrap();
172+
json_snapshot::initialize_engine_state(&standalone.storage, snapshot).unwrap();
173173
let standalone_result = standalone
174174
.submit_raw("submit", &runner.context, &[])
175175
.unwrap();

engine-tests/src/tests/standalone/json_snapshot.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ fn test_consume_snapshot() {
1515
)
1616
.unwrap();
1717
let mut runner = standalone::StandaloneRunner::default();
18-
json_snapshot::initialize_engine_state(&mut runner.storage, snapshot.clone()).unwrap();
18+
json_snapshot::initialize_engine_state(&runner.storage, snapshot.clone()).unwrap();
1919

2020
// check accounts to see they were written properly
2121
runner.env.block_height = snapshot.result.block_height + 1;
@@ -53,7 +53,7 @@ fn test_produce_snapshot() {
5353
.storage
5454
.set_engine_account_id(&"aurora".parse().unwrap())
5555
.unwrap();
56-
json_snapshot::initialize_engine_state(&mut runner.storage, snapshot.clone()).unwrap();
56+
json_snapshot::initialize_engine_state(&runner.storage, snapshot.clone()).unwrap();
5757

5858
// add a couple more transactions that write some extra keys
5959
runner.env.block_height = snapshot.result.block_height + 1;

engine-tests/src/tests/transaction.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -141,7 +141,7 @@ fn test_access_list_tx_encoding_decoding() {
141141

142142
let signed_tx = utils::sign_access_list_transaction(transaction, &secret_key);
143143
let bytes: Vec<u8> = iter::once(eip_2930::TYPE_BYTE)
144-
.chain(rlp::encode(&signed_tx).into_iter())
144+
.chain(rlp::encode(&signed_tx))
145145
.collect();
146146
let expected_bytes = hex::decode("01f8f901800a83061a8094095e7baea6a6c7c4c2dfeb977efac326af552d87830186a000f893f85994095e7baea6a6c7c4c2dfeb977efac326af552d87f842a00000000000000000000000000000000000000000000000000000000000000000a00000000000000000000000000000000000000000000000000000000000000001f794195e7baea6a6c7c4c2dfeb977efac326af552d87e1a0000000000000000000000000000000000000000000000000000000000000000080a011c97e0bb8a356fe4f49b37863d059c6fe8cd3214a6ac06a8387a2f6f0b75f60a0212368a1097da30806edfd13d9c35662e1baee939235eb25de867980bd0eda26").unwrap();
147147

@@ -163,7 +163,7 @@ fn test_access_list_tx_encoding_decoding() {
163163

164164
fn encode_tx(signed_tx: &SignedTransaction1559) -> Vec<u8> {
165165
iter::once(eip_1559::TYPE_BYTE)
166-
.chain(rlp::encode(signed_tx).into_iter())
166+
.chain(rlp::encode(signed_tx))
167167
.collect()
168168
}
169169

0 commit comments

Comments
 (0)