-
Notifications
You must be signed in to change notification settings - Fork 11
Closed
Labels
refactorRefactoring task that may be left for the appropriate timeRefactoring task that may be left for the appropriate time
Description
In my last PRs I felt that the imports organization were getting out of hand.
Not only with unused imports, but in particular I haven't put the effort to have clean imports and this means lots of unstructured lines importing stuff like:
pod2/src/backends/plonky2/circuits/mainpod.rs
Lines 1 to 29 in 3b2860b
| use anyhow::Result; | |
| use itertools::Itertools; | |
| use plonky2::{ | |
| field::types::Field, | |
| hash::{ | |
| hash_types::{HashOut, HashOutTarget}, | |
| poseidon::PoseidonHash, | |
| }, | |
| iop::{ | |
| target::{BoolTarget, Target}, | |
| witness::{PartialWitness, WitnessWrite}, | |
| }, | |
| plonk::circuit_builder::CircuitBuilder, | |
| }; | |
| use std::collections::HashMap; | |
| use std::iter; | |
| use crate::backends::plonky2::basetypes::{Hash, Value, D, EMPTY_HASH, EMPTY_VALUE, F, VALUE_SIZE}; | |
| use crate::backends::plonky2::circuits::common::{ | |
| CircuitBuilderPod, OperationTarget, StatementTarget, ValueTarget, | |
| }; | |
| use crate::backends::plonky2::primitives::merkletree::{MerkleProof, MerkleTree}; | |
| use crate::backends::plonky2::primitives::merkletree::{ | |
| MerkleProofExistenceGate, MerkleProofExistenceTarget, | |
| }; | |
| use crate::middleware::{ | |
| hash_str, AnchoredKey, NativeOperation, NativePredicate, Params, PodType, Predicate, Statement, | |
| StatementArg, ToFields, KEY_TYPE, SELF, STATEMENT_ARG_F_LEN, | |
| }; |
For example here I was sloppy and I didn't merge line 22 and 23.
This chore can be easily automated with a configuration of rustfmt, so I would propose to add a rustfmt.toml file in the root with these settings:
imports_granularity = "Crate"See https://rust-lang.github.io/rustfmt/?version=v1.8.0&search=imports_gran#imports_granularity
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
refactorRefactoring task that may be left for the appropriate timeRefactoring task that may be left for the appropriate time