From 70ebab2c8284d1900732a3267c19b6f500804681 Mon Sep 17 00:00:00 2001 From: buffalu <85544055+buffalu@users.noreply.github.com> Date: Fri, 18 Feb 2022 23:32:29 -0600 Subject: [PATCH] Add rustfmt.toml and `cargo fmt` (#23238) * fmt * formatted Co-authored-by: Lucas B --- banks-client/src/lib.rs | 6 +++-- core/benches/sigverify_stage.rs | 5 ++++- core/src/consensus.rs | 2 +- core/src/sigverify_stage.rs | 21 +++++++++++------- core/src/tower1_7_14.rs | 16 ++++++++------ core/src/tower_storage.rs | 6 +++-- core/src/tvu.rs | 3 +-- dos/src/main.rs | 7 ++++-- perf/src/sigverify.rs | 11 ++++++---- program-runtime/src/sysvar_cache.rs | 2 +- .../tests/common.rs | 3 +-- .../tests/extend_lookup_table_ix.rs | 6 ++--- programs/address-lookup-table/src/state.rs | 3 +-- rpc/src/rpc_pubsub_service.rs | 3 +-- rpc/src/rpc_subscriptions.rs | 4 ++-- runtime/src/bank.rs | 9 ++++---- runtime/src/sorted_storages.rs | 3 +-- runtime/src/stake_history.rs | 3 +-- runtime/src/vote_parser.rs | 14 +++++++----- rustfmt.toml | 2 ++ sdk/program/src/example_mocks.rs | 22 +++++++------------ sdk/program/src/slot_hashes.rs | 3 +-- sdk/src/example_mocks.rs | 6 +++-- sdk/src/transaction_context.rs | 22 ++++++++++--------- sdk/src/wasm/transaction.rs | 6 +---- streamer/src/quic.rs | 10 +++++---- zk-token-sdk/src/errors.rs | 6 +++-- zk-token-sdk/src/range_proof/errors.rs | 3 +-- .../src/sigma_proofs/equality_proof.rs | 6 +++-- zk-token-sdk/src/sigma_proofs/errors.rs | 3 +-- zk-token-sdk/src/sigma_proofs/fee_proof.rs | 3 +-- .../src/sigma_proofs/validity_proof.rs | 6 +++-- .../src/sigma_proofs/zero_balance_proof.rs | 10 +++++---- 33 files changed, 127 insertions(+), 108 deletions(-) create mode 100644 rustfmt.toml diff --git a/banks-client/src/lib.rs b/banks-client/src/lib.rs index d59eb2d596..cb3b053731 100644 --- a/banks-client/src/lib.rs +++ b/banks-client/src/lib.rs @@ -5,8 +5,10 @@ //! but they are undocumented, may change over time, and are generally more //! cumbersome to use. -pub use crate::error::BanksClientError; -pub use solana_banks_interface::{BanksClient as TarpcClient, TransactionStatus}; +pub use { + crate::error::BanksClientError, + solana_banks_interface::{BanksClient as TarpcClient, TransactionStatus}, +}; use { borsh::BorshDeserialize, futures::{future::join_all, Future, FutureExt, TryFutureExt}, diff --git a/core/benches/sigverify_stage.rs b/core/benches/sigverify_stage.rs index e8fadfee44..f5defc8144 100644 --- a/core/benches/sigverify_stage.rs +++ b/core/benches/sigverify_stage.rs @@ -9,7 +9,10 @@ use { log::*, rand::{thread_rng, Rng}, solana_core::{sigverify::TransactionSigVerifier, sigverify_stage::SigVerifyStage}, - solana_perf::{packet::to_packet_batches, packet::PacketBatch, test_tx::test_tx}, + solana_perf::{ + packet::{to_packet_batches, PacketBatch}, + test_tx::test_tx, + }, solana_sdk::{ hash::Hash, signature::{Keypair, Signer}, diff --git a/core/src/consensus.rs b/core/src/consensus.rs index 92456ae1c9..0cb9ce9105 100644 --- a/core/src/consensus.rs +++ b/core/src/consensus.rs @@ -1,9 +1,9 @@ -use crate::tower1_7_14::Tower1_7_14; use { crate::{ heaviest_subtree_fork_choice::HeaviestSubtreeForkChoice, latest_validator_votes_for_frozen_banks::LatestValidatorVotesForFrozenBanks, progress_map::{LockoutIntervals, ProgressMap}, + tower1_7_14::Tower1_7_14, tower_storage::{SavedTower, SavedTowerVersions, TowerStorage}, }, chrono::prelude::*, diff --git a/core/src/sigverify_stage.rs b/core/src/sigverify_stage.rs index baf4cd37d9..03bf6005b4 100644 --- a/core/src/sigverify_stage.rs +++ b/core/src/sigverify_stage.rs @@ -11,8 +11,10 @@ use { crossbeam_channel::{Receiver, RecvTimeoutError, SendError, Sender}, itertools::Itertools, solana_measure::measure::Measure, - solana_perf::packet::PacketBatch, - solana_perf::sigverify::{count_valid_packets, shrink_batches, Deduper}, + solana_perf::{ + packet::PacketBatch, + sigverify::{count_valid_packets, shrink_batches, Deduper}, + }, solana_sdk::timing, solana_streamer::streamer::{self, PacketBatchReceiver, StreamerError}, std::{ @@ -370,12 +372,15 @@ impl SigVerifyStage { #[cfg(test)] mod tests { - use crate::sigverify::TransactionSigVerifier; - use crate::sigverify_stage::timing::duration_as_ms; - use crossbeam_channel::unbounded; - use solana_perf::packet::to_packet_batches; - use solana_perf::test_tx::test_tx; - use {super::*, solana_perf::packet::Packet}; + use { + super::*, + crate::{sigverify::TransactionSigVerifier, sigverify_stage::timing::duration_as_ms}, + crossbeam_channel::unbounded, + solana_perf::{ + packet::{to_packet_batches, Packet}, + test_tx::test_tx, + }, + }; fn count_non_discard(packet_batches: &[PacketBatch]) -> usize { packet_batches diff --git a/core/src/tower1_7_14.rs b/core/src/tower1_7_14.rs index f092932816..8b7d3e8305 100644 --- a/core/src/tower1_7_14.rs +++ b/core/src/tower1_7_14.rs @@ -1,11 +1,13 @@ -use crate::consensus::{SwitchForkDecision, TowerError}; -use solana_sdk::{ - clock::Slot, - hash::Hash, - pubkey::Pubkey, - signature::{Signature, Signer}, +use { + crate::consensus::{SwitchForkDecision, TowerError}, + solana_sdk::{ + clock::Slot, + hash::Hash, + pubkey::Pubkey, + signature::{Signature, Signer}, + }, + solana_vote_program::vote_state::{BlockTimestamp, Vote, VoteState}, }; -use solana_vote_program::vote_state::{BlockTimestamp, Vote, VoteState}; #[frozen_abi(digest = "7phMrqmBo2D3rXPdhBj8CpjRvvmx9qgpcU4cDGkL3W9q")] #[derive(Clone, Serialize, Deserialize, Debug, PartialEq, AbiExample)] diff --git a/core/src/tower_storage.rs b/core/src/tower_storage.rs index ff37e745ee..7e8f137a75 100644 --- a/core/src/tower_storage.rs +++ b/core/src/tower_storage.rs @@ -1,6 +1,8 @@ use { - crate::consensus::{Result, Tower, TowerError, TowerVersions}, - crate::tower1_7_14::SavedTower1_7_14, + crate::{ + consensus::{Result, Tower, TowerError, TowerVersions}, + tower1_7_14::SavedTower1_7_14, + }, solana_sdk::{ pubkey::Pubkey, signature::{Signature, Signer}, diff --git a/core/src/tvu.rs b/core/src/tvu.rs index 6c8a9961b1..0b7942f3d1 100644 --- a/core/src/tvu.rs +++ b/core/src/tvu.rs @@ -417,8 +417,7 @@ pub mod tests { solana_runtime::bank::Bank, solana_sdk::signature::{Keypair, Signer}, solana_streamer::socket::SocketAddrSpace, - std::sync::atomic::AtomicU64, - std::sync::atomic::Ordering, + std::sync::atomic::{AtomicU64, Ordering}, }; #[ignore] diff --git a/dos/src/main.rs b/dos/src/main.rs index 0db3ad0e12..1ad3625e19 100644 --- a/dos/src/main.rs +++ b/dos/src/main.rs @@ -271,8 +271,11 @@ fn main() { #[cfg(test)] pub mod test { - use solana_local_cluster::{cluster::Cluster, local_cluster::LocalCluster}; - use {super::*, solana_sdk::timing::timestamp}; + use { + super::*, + solana_local_cluster::{cluster::Cluster, local_cluster::LocalCluster}, + solana_sdk::timing::timestamp, + }; #[test] fn test_dos() { diff --git a/perf/src/sigverify.rs b/perf/src/sigverify.rs index df330da128..e11c9409c0 100644 --- a/perf/src/sigverify.rs +++ b/perf/src/sigverify.rs @@ -25,10 +25,13 @@ use { short_vec::decode_shortu16_len, signature::Signature, }, - std::hash::Hasher, - std::sync::atomic::{AtomicBool, AtomicU64, Ordering}, - std::time::{Duration, Instant}, - std::{convert::TryFrom, mem::size_of}, + std::{ + convert::TryFrom, + hash::Hasher, + mem::size_of, + sync::atomic::{AtomicBool, AtomicU64, Ordering}, + time::{Duration, Instant}, + }, }; // Representing key tKeYE4wtowRb8yRroZShTipE18YVnqwXjsSAoNsFU6g diff --git a/program-runtime/src/sysvar_cache.rs b/program-runtime/src/sysvar_cache.rs index 907eaa9fea..143ae5e111 100644 --- a/program-runtime/src/sysvar_cache.rs +++ b/program-runtime/src/sysvar_cache.rs @@ -1,7 +1,7 @@ -use crate::invoke_context::InvokeContext; #[allow(deprecated)] use solana_sdk::sysvar::{fees::Fees, recent_blockhashes::RecentBlockhashes}; use { + crate::invoke_context::InvokeContext, solana_sdk::{ account::{AccountSharedData, ReadableAccount}, instruction::InstructionError, diff --git a/programs/address-lookup-table-tests/tests/common.rs b/programs/address-lookup-table-tests/tests/common.rs index a29fd6010f..3aa21bc898 100644 --- a/programs/address-lookup-table-tests/tests/common.rs +++ b/programs/address-lookup-table-tests/tests/common.rs @@ -10,8 +10,7 @@ use { account::AccountSharedData, clock::Slot, hash::Hash, - instruction::Instruction, - instruction::InstructionError, + instruction::{Instruction, InstructionError}, pubkey::Pubkey, signature::{Keypair, Signer}, slot_hashes::SlotHashes, diff --git a/programs/address-lookup-table-tests/tests/extend_lookup_table_ix.rs b/programs/address-lookup-table-tests/tests/extend_lookup_table_ix.rs index 576895a0c4..ca88549fd3 100644 --- a/programs/address-lookup-table-tests/tests/extend_lookup_table_ix.rs +++ b/programs/address-lookup-table-tests/tests/extend_lookup_table_ix.rs @@ -10,14 +10,12 @@ use { solana_program_test::*, solana_sdk::{ account::ReadableAccount, - instruction::Instruction, - instruction::InstructionError, + instruction::{Instruction, InstructionError}, pubkey::{Pubkey, PUBKEY_BYTES}, signature::{Keypair, Signer}, transaction::{Transaction, TransactionError}, }, - std::borrow::Cow, - std::result::Result, + std::{borrow::Cow, result::Result}, }; mod common; diff --git a/programs/address-lookup-table/src/state.rs b/programs/address-lookup-table/src/state.rs index c2f50c6ab7..78f4c1d931 100644 --- a/programs/address-lookup-table/src/state.rs +++ b/programs/address-lookup-table/src/state.rs @@ -218,8 +218,7 @@ impl<'a> AddressLookupTable<'a> { #[cfg(test)] mod tests { - use super::*; - use solana_sdk::hash::Hash; + use {super::*, solana_sdk::hash::Hash}; impl AddressLookupTable<'_> { fn new_for_tests(meta: LookupTableMeta, num_addresses: usize) -> Self { diff --git a/rpc/src/rpc_pubsub_service.rs b/rpc/src/rpc_pubsub_service.rs index 78e7a113f3..16cb053492 100644 --- a/rpc/src/rpc_pubsub_service.rs +++ b/rpc/src/rpc_pubsub_service.rs @@ -200,8 +200,7 @@ impl TestBroadcastReceiver { } pub fn recv_timeout(&mut self, timeout: std::time::Duration) -> Result { - use std::thread::sleep; - use tokio::sync::broadcast::error::TryRecvError; + use {std::thread::sleep, tokio::sync::broadcast::error::TryRecvError}; let started = std::time::Instant::now(); diff --git a/rpc/src/rpc_subscriptions.rs b/rpc/src/rpc_subscriptions.rs index 374b5f123c..1768a3a335 100644 --- a/rpc/src/rpc_subscriptions.rs +++ b/rpc/src/rpc_subscriptions.rs @@ -1195,8 +1195,8 @@ pub(crate) mod tests { }, serial_test::serial, solana_client::rpc_config::{ - RpcAccountInfoConfig, RpcProgramAccountsConfig, RpcSignatureSubscribeConfig, - RpcTransactionLogsFilter, {RpcBlockSubscribeConfig, RpcBlockSubscribeFilter}, + RpcAccountInfoConfig, RpcBlockSubscribeConfig, RpcBlockSubscribeFilter, + RpcProgramAccountsConfig, RpcSignatureSubscribeConfig, RpcTransactionLogsFilter, }, solana_runtime::{ commitment::BlockCommitment, diff --git a/runtime/src/bank.rs b/runtime/src/bank.rs index fedfd6d61e..00cc68914c 100644 --- a/runtime/src/bank.rs +++ b/runtime/src/bank.rs @@ -245,8 +245,7 @@ pub struct SquashTiming { type EpochCount = u64; mod executor_cache { - use super::*; - use log; + use {super::*, log}; #[derive(Debug, Default)] pub struct Stats { @@ -16162,8 +16161,10 @@ pub(crate) mod tests { /// Test exceeding the accounts data budget by creating accounts in a loop #[test] fn test_accounts_data_budget_exceeded() { - use solana_program_runtime::accounts_data_meter::MAX_ACCOUNTS_DATA_LEN; - use solana_sdk::system_instruction::MAX_PERMITTED_DATA_LENGTH; + use { + solana_program_runtime::accounts_data_meter::MAX_ACCOUNTS_DATA_LEN, + solana_sdk::system_instruction::MAX_PERMITTED_DATA_LENGTH, + }; solana_logger::setup(); let (genesis_config, mint_keypair) = create_genesis_config(1_000_000_000_000); diff --git a/runtime/src/sorted_storages.rs b/runtime/src/sorted_storages.rs index 126c32348f..51e514a9e6 100644 --- a/runtime/src/sorted_storages.rs +++ b/runtime/src/sorted_storages.rs @@ -3,8 +3,7 @@ use { log::*, solana_measure::measure::Measure, solana_sdk::clock::Slot, - std::ops::Range, - std::ops::{Bound, RangeBounds}, + std::ops::{Bound, Range, RangeBounds}, }; /// Provide access to SnapshotStorages sorted by slot diff --git a/runtime/src/stake_history.rs b/runtime/src/stake_history.rs index 27c7674008..31ca94dcce 100644 --- a/runtime/src/stake_history.rs +++ b/runtime/src/stake_history.rs @@ -27,8 +27,7 @@ type StakeHistoryInner = solana_sdk::stake_history::StakeHistory; #[cfg(test)] mod tests { - use super::*; - use solana_sdk::stake_history::StakeHistoryEntry; + use {super::*, solana_sdk::stake_history::StakeHistoryEntry}; fn rand_stake_history_entry() -> StakeHistoryEntry { StakeHistoryEntry { diff --git a/runtime/src/vote_parser.rs b/runtime/src/vote_parser.rs index 7e26f2bee3..2587e154d4 100644 --- a/runtime/src/vote_parser.rs +++ b/runtime/src/vote_parser.rs @@ -88,13 +88,17 @@ fn parse_vote_instruction_data( #[cfg(test)] mod test { - use solana_sdk::signature::{Keypair, Signer}; - use solana_vote_program::{ - vote_instruction, vote_state::Vote, vote_transaction::new_vote_transaction, + use { + super::*, + solana_sdk::{ + hash::hash, + signature::{Keypair, Signer}, + }, + solana_vote_program::{ + vote_instruction, vote_state::Vote, vote_transaction::new_vote_transaction, + }, }; - use {super::*, solana_sdk::hash::hash}; - fn run_test_parse_vote_transaction(input_hash: Option) { let node_keypair = Keypair::new(); let vote_keypair = Keypair::new(); diff --git a/rustfmt.toml b/rustfmt.toml new file mode 100644 index 0000000000..e26d07f0d8 --- /dev/null +++ b/rustfmt.toml @@ -0,0 +1,2 @@ +imports_granularity = "One" +group_imports = "One" diff --git a/sdk/program/src/example_mocks.rs b/sdk/program/src/example_mocks.rs index 082aee3cc4..5b53ccd8d5 100644 --- a/sdk/program/src/example_mocks.rs +++ b/sdk/program/src/example_mocks.rs @@ -24,10 +24,10 @@ pub mod solana_client { } pub mod rpc_client { - use super::super::solana_sdk::{ - hash::Hash, signature::Signature, transaction::Transaction, + use super::{ + super::solana_sdk::{hash::Hash, signature::Signature, transaction::Transaction}, + client_error::Result as ClientResult, }; - use super::client_error::Result as ClientResult; pub struct RpcClient; @@ -63,12 +63,7 @@ pub mod solana_client { /// This lets examples in solana-program appear to be written as client /// programs. pub mod solana_sdk { - pub use crate::hash; - pub use crate::instruction; - pub use crate::message; - pub use crate::nonce; - pub use crate::pubkey; - pub use crate::system_instruction; + pub use crate::{hash, instruction, message, nonce, pubkey, system_instruction}; pub mod signature { use crate::pubkey::Pubkey; @@ -103,11 +98,10 @@ pub mod solana_sdk { } pub mod transaction { - use super::signers::Signers; - use crate::hash::Hash; - use crate::instruction::Instruction; - use crate::message::Message; - use crate::pubkey::Pubkey; + use { + super::signers::Signers, + crate::{hash::Hash, instruction::Instruction, message::Message, pubkey::Pubkey}, + }; pub struct Transaction { pub message: Message, diff --git a/sdk/program/src/slot_hashes.rs b/sdk/program/src/slot_hashes.rs index 6fafbd7ee9..56d891b7aa 100644 --- a/sdk/program/src/slot_hashes.rs +++ b/sdk/program/src/slot_hashes.rs @@ -2,13 +2,12 @@ //! //! this account carries the Bank's most recent bank hashes for some N parents //! +pub use crate::clock::Slot; use { crate::hash::Hash, std::{iter::FromIterator, ops::Deref}, }; -pub use crate::clock::Slot; - pub const MAX_ENTRIES: usize = 512; // about 2.5 minutes to get your vote in // This is to allow tests with custom slot hash expiry to avoid having to generate diff --git a/sdk/src/example_mocks.rs b/sdk/src/example_mocks.rs index 47106d9f16..33a01c0b4a 100644 --- a/sdk/src/example_mocks.rs +++ b/sdk/src/example_mocks.rs @@ -24,8 +24,10 @@ pub mod solana_client { } pub mod rpc_client { - use super::client_error::Result as ClientResult; - use crate::{hash::Hash, signature::Signature, transaction::Transaction}; + use { + super::client_error::Result as ClientResult, + crate::{hash::Hash, signature::Signature, transaction::Transaction}, + }; pub struct RpcClient; diff --git a/sdk/src/transaction_context.rs b/sdk/src/transaction_context.rs index 517f5a6acc..eb7b6eb4a3 100644 --- a/sdk/src/transaction_context.rs +++ b/sdk/src/transaction_context.rs @@ -1,15 +1,17 @@ //! Successors of instruction_context_context::StackFrame, KeyedAccount and AccountInfo -use crate::{ - account::{AccountSharedData, ReadableAccount, WritableAccount}, - instruction::InstructionError, - lamports::LamportsError, - pubkey::Pubkey, -}; -use std::{ - cell::{RefCell, RefMut}, - collections::HashSet, - pin::Pin, +use { + crate::{ + account::{AccountSharedData, ReadableAccount, WritableAccount}, + instruction::InstructionError, + lamports::LamportsError, + pubkey::Pubkey, + }, + std::{ + cell::{RefCell, RefMut}, + collections::HashSet, + pin::Pin, + }, }; pub type TransactionAccount = (Pubkey, AccountSharedData); diff --git a/sdk/src/wasm/transaction.rs b/sdk/src/wasm/transaction.rs index 4b8bc6f825..208a76bfa2 100644 --- a/sdk/src/wasm/transaction.rs +++ b/sdk/src/wasm/transaction.rs @@ -2,11 +2,7 @@ #![cfg(target_arch = "wasm32")] #![allow(non_snake_case)] use { - crate::{ - hash::Hash, - signer::keypair::Keypair, - {message::Message, transaction::Transaction}, - }, + crate::{hash::Hash, message::Message, signer::keypair::Keypair, transaction::Transaction}, solana_program::{ pubkey::Pubkey, wasm::{display_to_jsvalue, instructions::Instructions}, diff --git a/streamer/src/quic.rs b/streamer/src/quic.rs index b936a04218..30657c4946 100644 --- a/streamer/src/quic.rs +++ b/streamer/src/quic.rs @@ -256,10 +256,12 @@ pub fn spawn_server( #[cfg(test)] mod test { - use super::*; - use crossbeam_channel::unbounded; - use quinn::{ClientConfig, NewConnection}; - use std::{net::SocketAddr, time::Instant}; + use { + super::*, + crossbeam_channel::unbounded, + quinn::{ClientConfig, NewConnection}, + std::{net::SocketAddr, time::Instant}, + }; struct SkipServerVerification; diff --git a/zk-token-sdk/src/errors.rs b/zk-token-sdk/src/errors.rs index 6e1f1c56ba..72b3ab77f2 100644 --- a/zk-token-sdk/src/errors.rs +++ b/zk-token-sdk/src/errors.rs @@ -1,6 +1,8 @@ //! Errors related to proving and verifying proofs. -use crate::{range_proof::errors::RangeProofError, sigma_proofs::errors::*}; -use thiserror::Error; +use { + crate::{range_proof::errors::RangeProofError, sigma_proofs::errors::*}, + thiserror::Error, +}; // TODO: clean up errors for encryption #[derive(Error, Clone, Debug, Eq, PartialEq)] diff --git a/zk-token-sdk/src/range_proof/errors.rs b/zk-token-sdk/src/range_proof/errors.rs index 6a50b3c9ab..b8766a2316 100644 --- a/zk-token-sdk/src/range_proof/errors.rs +++ b/zk-token-sdk/src/range_proof/errors.rs @@ -1,6 +1,5 @@ //! Errors related to proving and verifying range proofs. -use crate::errors::TranscriptError; -use thiserror::Error; +use {crate::errors::TranscriptError, thiserror::Error}; #[derive(Error, Clone, Debug, Eq, PartialEq)] pub enum RangeProofError { diff --git a/zk-token-sdk/src/sigma_proofs/equality_proof.rs b/zk-token-sdk/src/sigma_proofs/equality_proof.rs index 0c90660f6c..b1cf5b0a55 100644 --- a/zk-token-sdk/src/sigma_proofs/equality_proof.rs +++ b/zk-token-sdk/src/sigma_proofs/equality_proof.rs @@ -448,8 +448,10 @@ impl CtxtCtxtEqualityProof { #[cfg(test)] mod test { - use super::*; - use crate::encryption::{elgamal::ElGamalSecretKey, pedersen::Pedersen}; + use { + super::*, + crate::encryption::{elgamal::ElGamalSecretKey, pedersen::Pedersen}, + }; #[test] fn test_ciphertext_commitment_equality_proof_correctness() { diff --git a/zk-token-sdk/src/sigma_proofs/errors.rs b/zk-token-sdk/src/sigma_proofs/errors.rs index e1bf03eae4..6a441b0f59 100644 --- a/zk-token-sdk/src/sigma_proofs/errors.rs +++ b/zk-token-sdk/src/sigma_proofs/errors.rs @@ -1,6 +1,5 @@ //! Errors related to proving and verifying sigma proofs. -use crate::errors::TranscriptError; -use thiserror::Error; +use {crate::errors::TranscriptError, thiserror::Error}; #[derive(Error, Clone, Debug, Eq, PartialEq)] pub enum EqualityProofError { diff --git a/zk-token-sdk/src/sigma_proofs/fee_proof.rs b/zk-token-sdk/src/sigma_proofs/fee_proof.rs index 767b240369..4d6d0c9a61 100644 --- a/zk-token-sdk/src/sigma_proofs/fee_proof.rs +++ b/zk-token-sdk/src/sigma_proofs/fee_proof.rs @@ -448,8 +448,7 @@ fn conditional_select_ristretto( #[cfg(test)] mod test { - use super::*; - use crate::encryption::pedersen::Pedersen; + use {super::*, crate::encryption::pedersen::Pedersen}; #[test] fn test_fee_above_max_proof() { diff --git a/zk-token-sdk/src/sigma_proofs/validity_proof.rs b/zk-token-sdk/src/sigma_proofs/validity_proof.rs index 8eb32d2dfb..687c2623cb 100644 --- a/zk-token-sdk/src/sigma_proofs/validity_proof.rs +++ b/zk-token-sdk/src/sigma_proofs/validity_proof.rs @@ -298,8 +298,10 @@ impl AggregatedValidityProof { #[cfg(test)] mod test { - use super::*; - use crate::encryption::{elgamal::ElGamalKeypair, pedersen::Pedersen}; + use { + super::*, + crate::encryption::{elgamal::ElGamalKeypair, pedersen::Pedersen}, + }; #[test] fn test_validity_proof_correctness() { diff --git a/zk-token-sdk/src/sigma_proofs/zero_balance_proof.rs b/zk-token-sdk/src/sigma_proofs/zero_balance_proof.rs index 38681674bc..00da0f0fe2 100644 --- a/zk-token-sdk/src/sigma_proofs/zero_balance_proof.rs +++ b/zk-token-sdk/src/sigma_proofs/zero_balance_proof.rs @@ -166,10 +166,12 @@ impl ZeroBalanceProof { #[cfg(test)] mod test { - use super::*; - use crate::encryption::{ - elgamal::{DecryptHandle, ElGamalKeypair, ElGamalSecretKey}, - pedersen::{Pedersen, PedersenCommitment, PedersenOpening}, + use { + super::*, + crate::encryption::{ + elgamal::{DecryptHandle, ElGamalKeypair, ElGamalSecretKey}, + pedersen::{Pedersen, PedersenCommitment, PedersenOpening}, + }, }; #[test]