Skip to content

Commit

Permalink
Fix clippy for new 1.52
Browse files Browse the repository at this point in the history
Signed-off-by: deniallugo <[email protected]>
  • Loading branch information
Deniallugo committed May 10, 2021
1 parent 0c4e59f commit f6a37ee
Show file tree
Hide file tree
Showing 16 changed files with 37 additions and 41 deletions.
2 changes: 1 addition & 1 deletion core/bin/zksync_api/src/api_server/admin_server.rs
Original file line number Diff line number Diff line change
Expand Up @@ -165,8 +165,8 @@ pub fn start_admin_server(
let _panic_sentinel = ThreadPanicNotify(panic_notify.clone());
actix_rt::System::new("api-server").block_on(async move {
let app_state = AppState {
connection_pool,
secret_auth,
connection_pool,
};

run_server(app_state, bind_to).await;
Expand Down
4 changes: 2 additions & 2 deletions core/bin/zksync_api/src/api_server/rest/v1/tokens.rs
Original file line number Diff line number Diff line change
Expand Up @@ -41,9 +41,9 @@ impl ApiTokensData {
fee_ticker: mpsc::Sender<TickerRequest>,
) -> Self {
Self {
pool,
tokens,
fee_ticker,
tokens,
pool,
}
}

Expand Down
7 changes: 2 additions & 5 deletions core/bin/zksync_api/src/api_server/tx_sender.rs
Original file line number Diff line number Diff line change
Expand Up @@ -957,11 +957,8 @@ async fn verify_txs_batch_signature(
if batch_sign_data.is_none() && tx.signature.is_none() {
return Err(SubmitError::TxAdd(TxAddError::MissingEthSignature));
}
if let Some(signature) = tx.signature {
Some(EthSignData { signature, message })
} else {
None
}
tx.signature
.map(|signature| EthSignData { signature, message })
}
}
} else {
Expand Down
2 changes: 1 addition & 1 deletion core/bin/zksync_api/src/fee_ticker/validator/cache.rs
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ pub(crate) struct TokenInMemoryCache {

impl TokenInDBCache {
pub fn new(pool: ConnectionPool, inner: TokenDBCache) -> Self {
Self { pool, inner }
Self { inner, pool }
}
}

Expand Down
2 changes: 1 addition & 1 deletion core/bin/zksync_eth_sender/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -173,9 +173,9 @@ impl<DB: DatabaseInterface> ETHSender<DB> {
drop(connection);

Self {
ethereum,
ongoing_ops,
db,
ethereum,
tx_queue,
gas_adjuster,
options,
Expand Down
2 changes: 1 addition & 1 deletion core/bin/zksync_forced_exit_requests/src/eth_watch.rs
Original file line number Diff line number Diff line change
Expand Up @@ -74,8 +74,8 @@ impl EthHttpClient {

let topics = ContractTopics::new(forced_exit_contract.abi());
Self {
forced_exit_contract,
web3,
forced_exit_contract,
topics,
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -73,8 +73,8 @@ impl<T: CoreInteractionWrapper> MempoolForcedExitSender<T> {

Self {
core_interaction_wrapper,
forced_exit_sender_account_id,
config,
forced_exit_sender_account_id,
sender_private_key,
}
}
Expand Down
12 changes: 6 additions & 6 deletions core/lib/circuit/src/allocated_structures.rs
Original file line number Diff line number Diff line change
Expand Up @@ -191,17 +191,17 @@ impl<E: RescueEngine> AllocatedOperationData<E> {
);

Ok(AllocatedOperationData {
eth_address,
pub_nonce,
amount_packed,
fee_packed,
fee,
amount_unpacked,
full_amount,
fee,
first_sig_msg,
second_sig_msg,
third_sig_msg,
new_pubkey_hash,
eth_address,
pub_nonce,
a,
b,
valid_from,
Expand Down Expand Up @@ -313,17 +313,17 @@ impl<E: RescueEngine> AllocatedOperationData<E> {
)?;

Ok(AllocatedOperationData {
eth_address,
pub_nonce,
amount_packed,
fee_packed,
fee,
amount_unpacked,
full_amount,
fee,
first_sig_msg,
second_sig_msg,
third_sig_msg,
new_pubkey_hash,
eth_address,
pub_nonce,
a,
b,
valid_from,
Expand Down
9 changes: 5 additions & 4 deletions core/lib/circuit/src/circuit.rs
Original file line number Diff line number Diff line change
Expand Up @@ -327,10 +327,11 @@ impl<'a, E: RescueEngine + JubjubEngine> Circuit<E> for ZkSyncCircuit<'a, E> {

let mut validator_balances_processable_tokens = {
assert_eq!(self.validator_balances.len(), params::total_tokens());
for balance in &self.validator_balances[params::number_of_processable_tokens()..] {
if let Some(ingored_tokens_balance) = balance {
assert!(ingored_tokens_balance.is_zero());
}
for balance in self.validator_balances[params::number_of_processable_tokens()..]
.iter()
.flatten()
{
assert!(balance.is_zero());
}
let allocated_validator_balances = allocate_numbers_vec(
cs.namespace(|| "validator_balances"),
Expand Down
6 changes: 3 additions & 3 deletions core/lib/crypto/src/merkle_tree/parallel_smt.rs
Original file line number Diff line number Diff line change
Expand Up @@ -95,11 +95,11 @@ where

Self {
items,
prehashed,
tree_depth,
hasher,
tree_depth,
root,
nodes,
prehashed,
cache,
}
}
Expand Down Expand Up @@ -527,8 +527,8 @@ where
right: Option<NodeRef>,
) -> NodeRef {
self.nodes.push(Node {
index,
depth,
index,
left,
right,
});
Expand Down
4 changes: 2 additions & 2 deletions core/lib/eth_client/src/clients/http_client.rs
Original file line number Diff line number Diff line change
Expand Up @@ -283,10 +283,10 @@ impl<S: EthereumSigner> ETHDirectClient<S> {

metrics::histogram!("eth_client.direct.failure_reason", start.elapsed());
Ok(Some(FailureInfo {
gas_limit,
gas_used,
revert_code,
revert_reason,
gas_used,
gas_limit,
}))
}
_ => Ok(None),
Expand Down
2 changes: 1 addition & 1 deletion core/lib/prover_utils/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -84,9 +84,9 @@ impl SetupForStepByStepProver {
download_setup_file,
)?);
Ok(SetupForStepByStepProver {
setup_power_of_two,
setup_polynomials,
hints,
setup_power_of_two,
key_monomial_form,
})
}
Expand Down
6 changes: 1 addition & 5 deletions core/lib/storage/src/ethereum/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -87,11 +87,7 @@ impl<'a, 'c> EthereumSchema<'a, 'c> {
);

// If there is an operation, convert it to the `Operation` type.
let op = if let Some(raw_op) = raw_op {
Some(raw_op.into_aggregated_op())
} else {
None
};
let op = raw_op.map(|raw| raw.into_aggregated_op());

// Convert the fields into expected format.
let op_type = AggregatedActionType::from_str(eth_op.op_type.as_ref())
Expand Down
2 changes: 1 addition & 1 deletion core/tests/loadtest/src/executor.rs
Original file line number Diff line number Diff line change
Expand Up @@ -487,7 +487,7 @@ impl LoadtestExecutor {
CHUNK_SIZES,
txs_queue
.into_iter()
.filter_map(|x| x)
.flatten()
.map(|(tx, sign)| monitor.send_tx(tx, sign)),
)
.await?;
Expand Down
2 changes: 1 addition & 1 deletion core/tests/testkit/src/eth_account.rs
Original file line number Diff line number Diff line change
Expand Up @@ -507,8 +507,8 @@ impl ETHExecResult {

Self {
success,
revert_reason,
receipt,
revert_reason,
}
}

Expand Down
14 changes: 8 additions & 6 deletions core/tests/testkit/src/external_commands.rs
Original file line number Diff line number Diff line change
Expand Up @@ -42,13 +42,15 @@ fn get_contract_address(deploy_script_out: &str) -> Option<(String, Address)> {
String::from("CONTRACTS_UPGRADE_GATEKEEPER_ADDR"),
Address::from_str(output).expect("can't parse contract address"),
))
} else if let Some(output) = deploy_script_out.strip_prefix("CONTRACTS_TEST_ERC20=0x") {
Some((
String::from("CONTRACTS_TEST_ERC20"),
Address::from_str(output).expect("can't parse contract address"),
))
} else {
None
deploy_script_out
.strip_prefix("CONTRACTS_TEST_ERC20=0x")
.map(|output| {
(
String::from("CONTRACTS_TEST_ERC20"),
Address::from_str(output).expect("can't parse contract address"),
)
})
}
}

Expand Down

0 comments on commit f6a37ee

Please sign in to comment.