Improve code formatting

This commit is contained in:
hu55a1n1 2024-01-11 03:43:12 -08:00
parent 483b31abd2
commit b304ddc059
7 changed files with 38 additions and 19 deletions

11
.rustfmt.toml Normal file
View file

@ -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

View file

@ -1,10 +1,11 @@
use alloc::borrow::Cow; use alloc::{borrow::Cow, vec::Vec};
use alloc::vec::Vec;
use ics23::CommitmentProof; use ics23::CommitmentProof;
use crate::error::ProofError; use crate::{
use crate::verifier::{ics23::Ics23MembershipVerifier, multi::MultiVerifier, Verifier}; error::ProofError,
verifier::{ics23::Ics23MembershipVerifier, multi::MultiVerifier, Verifier},
};
type Key = Vec<u8>; type Key = Vec<u8>;
type Value<'a> = Cow<'a, [u8]>; type Value<'a> = Cow<'a, [u8]>;

View file

@ -6,8 +6,7 @@ use ics23::{
ProofSpec, ProofSpec,
}; };
use crate::error::ProofError; use crate::{error::ProofError, verifier::Verifier};
use crate::verifier::Verifier;
#[derive(Clone, Debug)] #[derive(Clone, Debug)]
pub struct Ics23MembershipVerifier<K, V> { pub struct Ics23MembershipVerifier<K, V> {

View file

@ -24,8 +24,11 @@ use std::{
use clap::{Parser, Subcommand}; use clap::{Parser, Subcommand};
use cosmrs::AccountId; use cosmrs::AccountId;
use cw_proof::proof::cw::RawCwProof; use cw_proof::proof::{
use cw_proof::proof::{cw::CwProof, key::CwAbciKey, Proof}; cw::{CwProof, RawCwProof},
key::CwAbciKey,
Proof,
};
use tendermint::{block::Height, AppHash}; use tendermint::{block::Height, AppHash};
use tendermint_rpc::{ use tendermint_rpc::{
client::HttpClient as TmRpcClient, endpoint::status::Response, Client, HttpClientUrl, 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)] #[cfg(test)]
mod tests { mod tests {
use cw_proof::{proof::cw::RawCwProof, proof::Proof}; use cw_proof::proof::{cw::RawCwProof, Proof};
use tendermint_rpc::endpoint::abci_query::AbciQuery; use tendermint_rpc::endpoint::abci_query::AbciQuery;
#[test] #[test]

View file

@ -21,9 +21,14 @@ use color_eyre::{
Report, Report,
}; };
use cosmrs::AccountId; use cosmrs::AccountId;
use cw_proof::error::ProofError; use cw_proof::{
use cw_proof::proof::cw::RawCwProof; error::ProofError,
use cw_proof::proof::{cw::CwProof, key::CwAbciKey, Proof}; proof::{
cw::{CwProof, RawCwProof},
key::CwAbciKey,
Proof,
},
};
use futures::future::join_all; use futures::future::join_all;
use serde::{Deserialize, Serialize}; use serde::{Deserialize, Serialize};
use tendermint::{crypto::default::Sha256, evidence::Evidence}; use tendermint::{crypto::default::Sha256, evidence::Evidence};

View file

@ -20,5 +20,4 @@ mod null_io;
mod provider; mod provider;
pub use error::Error; pub use error::Error;
pub use provider::make_provider; pub use provider::{make_provider, StatelessProvider};
pub use provider::StatelessProvider;

View file

@ -1,6 +1,8 @@
use alloc::boxed::Box; use alloc::{
use alloc::string::{String, ToString}; boxed::Box,
use alloc::vec::Vec; string::{String, ToString},
vec::Vec,
};
use tendermint::Hash; use tendermint::Hash;
use tendermint_light_client::{ use tendermint_light_client::{
@ -14,8 +16,7 @@ use tendermint_light_client::{
verifier::ProdVerifier, verifier::ProdVerifier,
}; };
use crate::error::Error; use crate::{error::Error, null_io::NullIo};
use crate::null_io::NullIo;
/// A interface over a stateless light client instance. /// A interface over a stateless light client instance.
#[derive(Debug)] #[derive(Debug)]