Organize imports (#188)

* Organize imports

Use rustfmt to organize imports.  Resolve #162

* remove unused imports

* cargo fmt
This commit is contained in:
Eduard S. 2025-04-07 16:19:13 -07:00 committed by GitHub
parent 1214cdfa1b
commit 24ff82dd3d
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
32 changed files with 329 additions and 276 deletions

View file

@ -4,13 +4,14 @@ use anyhow::Result;
use schemars::JsonSchema;
use serde::{Deserialize, Serialize};
use super::Value;
use crate::frontend::serialization::ordered_map;
use crate::middleware::{
containers::{
Array as MiddlewareArray, Dictionary as MiddlewareDictionary, Set as MiddlewareSet,
use crate::{
frontend::{serialization::ordered_map, Value},
middleware::{
containers::{
Array as MiddlewareArray, Dictionary as MiddlewareDictionary, Set as MiddlewareSet,
},
hash_str, Value as MiddlewareValue,
},
hash_str, Value as MiddlewareValue,
};
#[derive(Clone, Debug, PartialEq, Eq, Serialize, JsonSchema)]

View file

@ -1,16 +1,15 @@
#![allow(unused)]
use std::{collections::HashMap, fmt, hash as h, iter, iter::zip, sync::Arc};
use anyhow::{anyhow, Result};
use schemars::JsonSchema;
use serde::{Deserialize, Serialize};
use std::collections::HashMap;
use std::iter::zip;
use std::sync::Arc;
use std::{fmt, hash as h, iter};
use crate::middleware::{self, hash_str, HashOrWildcard, Params, PodId, ToFields};
use crate::util::hashmap_insert_no_dupe;
use super::{AnchoredKey, NativePredicate, Origin, Statement, StatementArg, Value};
use crate::{
frontend::{AnchoredKey, NativePredicate, Origin, Statement, StatementArg, Value},
middleware::{self, hash_str, HashOrWildcard, Params, PodId, ToFields},
util::hashmap_insert_no_dupe,
};
#[derive(Clone, Debug, PartialEq, Eq, h::Hash, Serialize, Deserialize, JsonSchema)]
/// Argument to a statement template

View file

@ -1,22 +1,21 @@
//! The frontend includes the user-level abstractions and user-friendly types to define and work
//! with Pods.
use crate::frontend::serialization::*;
use crate::middleware::{
self, hash_str, Hash, MainPodInputs, Params, PodId, PodProver, PodSigner, SELF,
};
use crate::middleware::{KEY_SIGNER, KEY_TYPE};
use std::{collections::HashMap, convert::From, fmt, hash as h, hash::Hasher};
use anyhow::{anyhow, Error, Result};
use containers::{Array, Dictionary, Set};
use itertools::Itertools;
use schemars::JsonSchema;
use serde::{Deserialize, Serialize};
use std::collections::HashMap;
use std::convert::From;
use std::hash::Hasher;
use std::{fmt, hash as h};
use crate::middleware::{hash_value, OperationAux, EMPTY_VALUE};
use crate::{
frontend::serialization::*,
middleware::{
self, hash_str, hash_value, Hash, MainPodInputs, OperationAux, Params, PodId, PodProver,
PodSigner, EMPTY_VALUE, KEY_SIGNER, KEY_TYPE, SELF,
},
};
pub mod containers;
mod custom;
@ -24,8 +23,7 @@ mod operation;
mod predicate;
mod serialization;
mod statement;
pub use custom::*;
pub use custom::{CustomPredicateRef, Predicate};
pub use custom::{CustomPredicateRef, Predicate, *};
pub use operation::*;
pub use predicate::*;
pub use statement::*;
@ -1152,13 +1150,15 @@ pub mod build_utils {
#[cfg(test)]
pub mod tests {
use super::*;
use crate::backends::plonky2::basetypes;
use crate::backends::plonky2::mock::mainpod::MockProver;
use crate::backends::plonky2::mock::signedpod::MockSigner;
use crate::backends::plonky2::primitives::merkletree::MerkleTree;
use crate::examples::{
eth_dos_pod_builder, eth_friend_signed_pod_builder, great_boy_pod_full_flow,
tickets_pod_full_flow, zu_kyc_pod_builder, zu_kyc_sign_pod_builders,
use crate::{
backends::plonky2::{
basetypes,
mock::{mainpod::MockProver, signedpod::MockSigner},
},
examples::{
eth_dos_pod_builder, eth_friend_signed_pod_builder, great_boy_pod_full_flow,
tickets_pod_full_flow, zu_kyc_pod_builder, zu_kyc_sign_pod_builders,
},
};
// Check that frontend public statements agree with those

View file

@ -2,8 +2,10 @@ use std::fmt;
use serde::{Deserialize, Serialize};
use super::{CustomPredicateRef, NativePredicate, Predicate, SignedPod, Statement, Value};
use crate::middleware::{self, OperationAux};
use crate::{
frontend::{CustomPredicateRef, NativePredicate, Predicate, SignedPod, Statement, Value},
middleware::{self, OperationAux},
};
#[derive(Clone, Debug, PartialEq, Eq)]
pub enum OperationArg {

View file

@ -1,9 +1,6 @@
use anyhow::{anyhow, Result};
use schemars::JsonSchema;
use serde::{Deserialize, Serialize};
use std::fmt;
use super::{AnchoredKey, SignedPod, Value};
use crate::middleware::{self, CustomPredicateRef};
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, Serialize, Deserialize, JsonSchema)]

View file

@ -3,13 +3,11 @@ use std::collections::{BTreeMap, HashMap};
use schemars::{JsonSchema, Schema};
use serde::{Deserialize, Serialize, Serializer};
use crate::backends::plonky2::mock::mainpod::MockMainPod;
use crate::backends::plonky2::mock::signedpod::MockSignedPod;
use crate::frontend::containers::Dictionary;
use crate::frontend::Statement;
use crate::middleware::PodId;
use super::{MainPod, SignedPod, Value};
use crate::{
backends::plonky2::mock::{mainpod::MockMainPod, signedpod::MockSignedPod},
frontend::{containers::Dictionary, MainPod, SignedPod, Statement, Value},
middleware::PodId,
};
#[derive(Serialize, Deserialize, JsonSchema)]
#[schemars(title = "SignedPod")]
@ -156,6 +154,7 @@ mod tests {
use anyhow::Result;
use schemars::generate::SchemaSettings;
use super::*;
use crate::{
backends::plonky2::mock::{mainpod::MockProver, signedpod::MockSigner},
examples::{zu_kyc_pod_builder, zu_kyc_sign_pod_builders},
@ -166,8 +165,6 @@ mod tests {
middleware::{self, Params},
};
use super::*;
#[test]
fn test_value_serialization() {
// Pairs of values and their expected serialized representations

View file

@ -1,10 +1,13 @@
use super::{AnchoredKey, NativePredicate, SignedPod, Value};
use crate::frontend::Predicate;
use crate::middleware;
use std::fmt;
use anyhow::{anyhow, Result};
use schemars::JsonSchema;
use serde::{Deserialize, Serialize};
use std::fmt;
use crate::{
frontend::{AnchoredKey, NativePredicate, Predicate, SignedPod, Value},
middleware,
};
#[derive(Clone, Debug, PartialEq, Eq, Serialize, Deserialize, JsonSchema)]
pub enum StatementArg {