diff --git a/.rustfmt.toml b/.rustfmt.toml new file mode 100644 index 0000000..50d8890 --- /dev/null +++ b/.rustfmt.toml @@ -0,0 +1,11 @@ +reorder_imports = true +reorder_modules = true + +# Automatically fix deprecated style. +use_field_init_shorthand = true +use_try_shorthand = true + +# unstable features +group_imports = "StdExternalCrate" +imports_granularity = "Crate" +format_code_in_doc_comments = true diff --git a/utils/cw-proof/src/verifier/cw.rs b/utils/cw-proof/src/verifier/cw.rs index 928eaf6..9836618 100644 --- a/utils/cw-proof/src/verifier/cw.rs +++ b/utils/cw-proof/src/verifier/cw.rs @@ -1,10 +1,11 @@ -use alloc::borrow::Cow; -use alloc::vec::Vec; +use alloc::{borrow::Cow, vec::Vec}; use ics23::CommitmentProof; -use crate::error::ProofError; -use crate::verifier::{ics23::Ics23MembershipVerifier, multi::MultiVerifier, Verifier}; +use crate::{ + error::ProofError, + verifier::{ics23::Ics23MembershipVerifier, multi::MultiVerifier, Verifier}, +}; type Key = Vec; type Value<'a> = Cow<'a, [u8]>; diff --git a/utils/cw-proof/src/verifier/ics23.rs b/utils/cw-proof/src/verifier/ics23.rs index 0ee7dbe..8cd78ff 100644 --- a/utils/cw-proof/src/verifier/ics23.rs +++ b/utils/cw-proof/src/verifier/ics23.rs @@ -6,8 +6,7 @@ use ics23::{ ProofSpec, }; -use crate::error::ProofError; -use crate::verifier::Verifier; +use crate::{error::ProofError, verifier::Verifier}; #[derive(Clone, Debug)] pub struct Ics23MembershipVerifier { diff --git a/utils/cw-prover/src/main.rs b/utils/cw-prover/src/main.rs index ece964e..fba2b32 100644 --- a/utils/cw-prover/src/main.rs +++ b/utils/cw-prover/src/main.rs @@ -24,8 +24,11 @@ use std::{ use clap::{Parser, Subcommand}; use cosmrs::AccountId; -use cw_proof::proof::cw::RawCwProof; -use cw_proof::proof::{cw::CwProof, key::CwAbciKey, Proof}; +use cw_proof::proof::{ + cw::{CwProof, RawCwProof}, + key::CwAbciKey, + Proof, +}; use tendermint::{block::Height, AppHash}; use tendermint_rpc::{ client::HttpClient as TmRpcClient, endpoint::status::Response, Client, HttpClientUrl, @@ -131,7 +134,7 @@ fn write_proof_to_file(proof_file: PathBuf, proof: RawCwProof) -> Result<(), Box #[cfg(test)] mod tests { - use cw_proof::{proof::cw::RawCwProof, proof::Proof}; + use cw_proof::proof::{cw::RawCwProof, Proof}; use tendermint_rpc::endpoint::abci_query::AbciQuery; #[test] diff --git a/utils/tm-prover/src/main.rs b/utils/tm-prover/src/main.rs index 203a32d..1225048 100644 --- a/utils/tm-prover/src/main.rs +++ b/utils/tm-prover/src/main.rs @@ -21,9 +21,14 @@ use color_eyre::{ Report, }; use cosmrs::AccountId; -use cw_proof::error::ProofError; -use cw_proof::proof::cw::RawCwProof; -use cw_proof::proof::{cw::CwProof, key::CwAbciKey, Proof}; +use cw_proof::{ + error::ProofError, + proof::{ + cw::{CwProof, RawCwProof}, + key::CwAbciKey, + Proof, + }, +}; use futures::future::join_all; use serde::{Deserialize, Serialize}; use tendermint::{crypto::default::Sha256, evidence::Evidence}; diff --git a/utils/tm-stateless-verifier/src/lib.rs b/utils/tm-stateless-verifier/src/lib.rs index 7f3d554..8f6cf65 100644 --- a/utils/tm-stateless-verifier/src/lib.rs +++ b/utils/tm-stateless-verifier/src/lib.rs @@ -20,5 +20,4 @@ mod null_io; mod provider; pub use error::Error; -pub use provider::make_provider; -pub use provider::StatelessProvider; +pub use provider::{make_provider, StatelessProvider}; diff --git a/utils/tm-stateless-verifier/src/provider.rs b/utils/tm-stateless-verifier/src/provider.rs index 9d8bedd..e8fb0ec 100644 --- a/utils/tm-stateless-verifier/src/provider.rs +++ b/utils/tm-stateless-verifier/src/provider.rs @@ -1,6 +1,8 @@ -use alloc::boxed::Box; -use alloc::string::{String, ToString}; -use alloc::vec::Vec; +use alloc::{ + boxed::Box, + string::{String, ToString}, + vec::Vec, +}; use tendermint::Hash; use tendermint_light_client::{ @@ -14,8 +16,7 @@ use tendermint_light_client::{ verifier::ProdVerifier, }; -use crate::error::Error; -use crate::null_io::NullIo; +use crate::{error::Error, null_io::NullIo}; /// A interface over a stateless light client instance. #[derive(Debug)]