Skip to content

Commit

Permalink
clippy: fix String/Vec unecessary import
Browse files Browse the repository at this point in the history
  • Loading branch information
hackaugusto committed Feb 26, 2024
1 parent 3c6285d commit 188e6d6
Show file tree
Hide file tree
Showing 64 changed files with 163 additions and 125 deletions.
1 change: 1 addition & 0 deletions miden-lib/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ authors = ["miden contributors"]
readme = "README.md"
license = "MIT"
repository = "https://github.com/0xPolygonMiden/miden-base"
categories = ["no-std"]
keywords = ["miden", "program", "stdlib", "transaction", "kernel"]
edition = "2021"
rust-version = "1.75"
Expand Down
2 changes: 1 addition & 1 deletion miden-lib/src/accounts/faucets/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,11 @@ use miden_objects::{
accounts::{Account, AccountCode, AccountId, AccountStorage, AccountType, StorageSlotType},
assembly::LibraryPath,
assets::{AssetVault, TokenSymbol},
utils::{string::ToString, vec},
AccountError, Felt, Word, ZERO,
};

use super::{AuthScheme, Library, MidenLib, TransactionKernel};
use crate::utils::{string::*, vec};

// FUNGIBLE FAUCET
// ================================================================================================
Expand Down
7 changes: 2 additions & 5 deletions miden-lib/src/accounts/wallets/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,12 @@ use miden_objects::{
accounts::{Account, AccountCode, AccountId, AccountStorage, AccountType, StorageSlotType},
assembly::ModuleAst,
assets::AssetVault,
utils::{
format,
string::{String, ToString},
vec,
},
utils::format,
AccountError, Word, ZERO,
};

use super::{AuthScheme, TransactionKernel};
use crate::utils::{string::*, vec};

// BASIC WALLET
// ================================================================================================
Expand Down
4 changes: 4 additions & 0 deletions miden-lib/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,10 @@ pub mod transaction;
#[cfg(test)]
mod tests;

// RE-EXPORTS
// ================================================================================================
pub use miden_objects::utils;

// STANDARD LIBRARY
// ================================================================================================

Expand Down
4 changes: 2 additions & 2 deletions miden-lib/src/notes/mod.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
use miden_objects::{
accounts::AccountId, assets::Asset, crypto::rand::FeltRng, notes::Note,
utils::collections::Vec, Felt, NoteError, Word,
accounts::AccountId, assets::Asset, crypto::rand::FeltRng, notes::Note, utils::collections::*,
Felt, NoteError, Word,
};

use self::utils::build_note_script;
Expand Down
2 changes: 1 addition & 1 deletion miden-lib/src/tests/test_note.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
use miden_objects::{
notes::Note,
transaction::{PreparedTransaction, TransactionArgs},
utils::collections::BTreeMap,
utils::collections::*,
WORD_SIZE,
};
use mock::{
Expand Down
2 changes: 1 addition & 1 deletion miden-lib/src/tests/test_prologue.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
use miden_objects::{
assembly::ProgramAst,
transaction::{PreparedTransaction, TransactionArgs, TransactionScript},
utils::collections::BTreeMap,
utils::collections::*,
Digest,
};
use mock::{
Expand Down
2 changes: 1 addition & 1 deletion miden-lib/src/transaction/errors.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
use core::fmt;

use miden_objects::{accounts::AccountStorage, utils::string::String, AssetError, Digest};
use miden_objects::{accounts::AccountStorage, utils::string::*, AssetError, Digest};

// TRANSACTION KERNEL ERROR
// ================================================================================================
Expand Down
2 changes: 1 addition & 1 deletion miden-lib/src/transaction/inputs.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,12 @@ use miden_objects::{
ChainMmr, ExecutedTransaction, InputNotes, PreparedTransaction, TransactionArgs,
TransactionInputs, TransactionScript, TransactionWitness,
},
utils::{collections::Vec, vec},
vm::{AdviceInputs, StackInputs},
Felt, Word, ZERO,
};

use super::TransactionKernel;
use crate::utils::{collections::*, vec};

// TRANSACTION KERNEL INPUTS
// ================================================================================================
Expand Down
3 changes: 2 additions & 1 deletion miden-lib/src/transaction/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,14 @@ use miden_objects::{
accounts::AccountId,
assembly::{Assembler, AssemblyContext, ProgramAst},
transaction::{OutputNotes, TransactionOutputs},
utils::{collections::Vec, group_slice_elements, serde::DeserializationError},
utils::{group_slice_elements, serde::DeserializationError},
vm::{AdviceMap, ProgramInfo, StackInputs, StackOutputs},
Digest, Felt, TransactionOutputError, Word,
};
use miden_stdlib::StdLibrary;

use super::MidenLib;
use crate::utils::collections::*;

pub mod memory;

Expand Down
2 changes: 1 addition & 1 deletion miden-lib/src/transaction/outputs.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ use miden_objects::{
assets::Asset,
notes::{NoteAssets, NoteId, NoteMetadata},
transaction::OutputNote,
utils::collections::Vec,
utils::collections::*,
AccountError, Digest, NoteError, Word, WORD_SIZE,
};

Expand Down
2 changes: 1 addition & 1 deletion miden-tx/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ readme = "README.md"
license = "MIT"
repository = "https://github.com/0xPolygonMiden/miden-base"
categories = ["no-std"]
keywords = []
keywords = ["miden", "transaction"]
edition = "2021"
rust-version = "1.75"

Expand Down
5 changes: 3 additions & 2 deletions miden-tx/src/compiler/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,10 @@ use miden_objects::{
};

use super::{
AccountCode, AccountId, BTreeMap, CodeBlock, Digest, NoteScript, Program,
TransactionCompilerError, TransactionKernel,
AccountCode, AccountId, CodeBlock, Digest, NoteScript, Program, TransactionCompilerError,
TransactionKernel,
};
use crate::utils::{collections::*, vec};

#[cfg(test)]
mod tests;
Expand Down
1 change: 1 addition & 0 deletions miden-tx/src/error.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ use miden_objects::{
use miden_verifier::VerificationError;

use super::{AccountError, AccountId, Digest, ExecutionError};
use crate::utils::string::*;

// TRANSACTION COMPILER ERROR
// ================================================================================================
Expand Down
1 change: 1 addition & 0 deletions miden-tx/src/executor/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ use super::{
RecAdviceProvider, ScriptTarget, TransactionCompiler, TransactionExecutorError,
TransactionHost,
};
use crate::utils::collections::*;

mod data;
pub use data::DataStore;
Expand Down
8 changes: 4 additions & 4 deletions miden-tx/src/host/account_delta.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,15 +5,15 @@ use miden_objects::{
AccountVaultDelta,
},
assets::{Asset, FungibleAsset, NonFungibleAsset},
utils::{
collections::{btree_map::Entry, BTreeMap},
string::ToString,
},
Digest, Felt, Word, EMPTY_WORD, ZERO,
};
use vm_processor::{ContextId, ProcessState};

use super::{AdviceProvider, TransactionHost};
use crate::utils::{
collections::{btree_map::*, *},
string::*,
};

// CONSTANTS
// ================================================================================================
Expand Down
3 changes: 2 additions & 1 deletion miden-tx/src/host/mod.rs
Original file line number Diff line number Diff line change
@@ -1,14 +1,15 @@
use miden_lib::transaction::{TransactionEvent, TransactionKernelError};
use miden_objects::{
accounts::{AccountDelta, AccountStub},
utils::{collections::BTreeMap, string::ToString},
Digest,
};
use vm_processor::{
crypto::NodeIndex, AdviceExtractor, AdviceInjector, AdviceProvider, AdviceSource, ContextId,
ExecutionError, Host, HostResponse, ProcessState,
};

use crate::utils::{collections::*, format, string::*};

mod account_delta;
use account_delta::AccountDeltaTracker;

Expand Down
10 changes: 9 additions & 1 deletion miden-tx/src/lib.rs
Original file line number Diff line number Diff line change
@@ -1,10 +1,14 @@
#![cfg_attr(not(feature = "std"), no_std)]

#[cfg(not(feature = "std"))]
extern crate alloc;

use miden_lib::transaction::TransactionKernel;
pub use miden_objects::transaction::TransactionInputs;
use miden_objects::{
accounts::{AccountCode, AccountId},
notes::{NoteId, NoteScript},
transaction::{ExecutedTransaction, PreparedTransaction},
utils::collections::BTreeMap,
vm::{CodeBlock, Program},
AccountError, Digest,
};
Expand Down Expand Up @@ -33,3 +37,7 @@ pub use error::{

#[cfg(test)]
mod tests;

// RE-EXPORTS
// ================================================================================================
pub use miden_objects::utils;
2 changes: 1 addition & 1 deletion miden-tx/tests/integration/scripts/p2id.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ use miden_objects::{
assets::{Asset, AssetVault, FungibleAsset},
crypto::rand::RpoRandomCoin,
transaction::TransactionArgs,
utils::collections::Vec,
utils::collections::*,
Felt,
};
use miden_tx::TransactionExecutor;
Expand Down
2 changes: 1 addition & 1 deletion miden-tx/tests/integration/scripts/p2idr.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ use miden_objects::{
assets::{Asset, AssetVault, FungibleAsset},
crypto::rand::RpoRandomCoin,
transaction::TransactionArgs,
utils::collections::Vec,
utils::collections::*,
Felt,
};
use miden_tx::TransactionExecutor;
Expand Down
8 changes: 5 additions & 3 deletions mock/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@ authors = ["miden contributors"]
readme = "README.md"
license = "MIT"
repository = "https://github.com/0xPolygonMiden/miden-base"
categories = []
keywords = []
categories = ["no-std"]
keywords = ["miden", "mock"]
edition = "2021"
rust-version = "1.75"

Expand All @@ -17,8 +17,10 @@ path = "src/main.rs"
required-features = ["executable"]

[features]
serde = ["dep:serde", "miden-objects/serde"]
default = ["std"]
executable = ["dep:clap", "serde"]
serde = ["dep:serde", "miden-objects/serde"]
std = ["miden-lib/std", "miden-objects/std"]

[dependencies]
clap = { version = "4.4", features = ["derive"], optional = true }
Expand Down
5 changes: 1 addition & 4 deletions mock/src/builders/account.rs
Original file line number Diff line number Diff line change
@@ -1,17 +1,14 @@
use miden_objects::{
accounts::{Account, AccountStorage, AccountType, SlotItem},
assets::{Asset, AssetVault},
utils::{
collections::Vec,
string::{String, ToString},
},
Felt, Word, ZERO,
};
use rand::Rng;

use crate::{
builders::{str_to_account_code, AccountBuilderError, AccountIdBuilder, AccountStorageBuilder},
constants::DEFAULT_ACCOUNT_CODE,
utils::{collections::*, string::*},
};

/// Builder for an `Account`, the builder allows for a fluent API to construct an account. Each
Expand Down
2 changes: 1 addition & 1 deletion mock/src/builders/account_id.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
use miden_objects::{
accounts::{AccountId, AccountType},
utils::string::{String, ToString},
utils::string::*,
Digest, Word,
};
use rand::Rng;
Expand Down
2 changes: 1 addition & 1 deletion mock/src/builders/account_storage.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
use miden_objects::{
accounts::{AccountStorage, SlotItem},
utils::collections::Vec,
utils::collections::*,
};

#[derive(Default, Debug, Clone)]
Expand Down
5 changes: 1 addition & 4 deletions mock/src/builders/note.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,12 @@ use miden_objects::{
assembly::ProgramAst,
assets::Asset,
notes::{Note, NoteInclusionProof, NoteInputs, NoteScript},
utils::{
collections::Vec,
string::{String, ToString},
},
Felt, NoteError, Word,
};
use rand::Rng;

use super::TransactionKernel;
use crate::utils::{collections::*, string::*};

const DEFAULT_NOTE_CODE: &str = "\
begin
Expand Down
5 changes: 5 additions & 0 deletions mock/src/lib.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
#![cfg_attr(not(feature = "std"), no_std)]

#[cfg(not(feature = "std"))]
extern crate alloc;

use std::{fs::File, io::Read, path::PathBuf};

use miden_lib::transaction::{memory, ToTransactionKernelInputs, TransactionKernel};
Expand Down
6 changes: 4 additions & 2 deletions mock/src/mock/block.rs
Original file line number Diff line number Diff line change
@@ -1,9 +1,11 @@
use miden_objects::{
accounts::Account, crypto::merkle::SimpleSmt, utils::collections::Vec, BlockHeader, Digest,
Felt, ACCOUNT_TREE_DEPTH, ZERO,
accounts::Account, crypto::merkle::SimpleSmt, BlockHeader, Digest, Felt, ACCOUNT_TREE_DEPTH,
ZERO,
};
use miden_test_utils::rand;

use crate::utils::collections::*;

pub fn mock_block_header(
block_num: u32,
chain_root: Option<Digest>,
Expand Down
2 changes: 1 addition & 1 deletion mock/src/mock/chain.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ use miden_objects::{
crypto::merkle::{LeafIndex, Mmr, PartialMmr, SimpleSmt, Smt},
notes::{Note, NoteInclusionProof},
transaction::{ChainMmr, InputNote},
utils::collections::Vec,
utils::collections::*,
BlockHeader, Digest, Felt, FieldElement, Word, ACCOUNT_TREE_DEPTH, NOTE_TREE_DEPTH,
};
use rand::{Rng, SeedableRng};
Expand Down
3 changes: 2 additions & 1 deletion mock/src/mock/host/mod.rs
Original file line number Diff line number Diff line change
@@ -1,14 +1,15 @@
use miden_lib::transaction::TransactionEvent;
use miden_objects::{
accounts::{delta::AccountVaultDelta, AccountStub},
utils::{collections::BTreeMap, string::ToString},
Digest,
};
use vm_processor::{
crypto::NodeIndex, AdviceExtractor, AdviceInjector, AdviceInputs, AdviceProvider, AdviceSource,
ContextId, ExecutionError, Host, HostResponse, MemAdviceProvider, ProcessState,
};

use crate::utils::{collections::*, string::*};

mod account_procs;
use account_procs::AccountProcedureIndexMap;

Expand Down
2 changes: 1 addition & 1 deletion mock/src/mock/notes.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ use miden_objects::{
assembly::{Assembler, ProgramAst},
assets::{Asset, FungibleAsset},
notes::{Note, NoteScript},
utils::collections::Vec,
utils::collections::*,
Felt, Word, ZERO,
};

Expand Down
2 changes: 1 addition & 1 deletion mock/src/mock/transaction.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ use miden_objects::{
ChainMmr, ExecutedTransaction, InputNote, InputNotes, OutputNote, OutputNotes,
TransactionArgs, TransactionInputs, TransactionOutputs,
},
utils::collections::Vec,
utils::collections::*,
BlockHeader, Felt, FieldElement,
};
use vm_processor::{AdviceInputs, Operation, Program, Word};
Expand Down
10 changes: 2 additions & 8 deletions mock/src/utils.rs
Original file line number Diff line number Diff line change
@@ -1,11 +1,5 @@
use miden_objects::{
notes::NoteAssets,
utils::{
collections::Vec,
string::{String, ToString},
},
Word,
};
pub use miden_objects::utils::*;
use miden_objects::{notes::NoteAssets, Word};

// TODO: These functions are duplicates from miden-lib/test/common/procedures.rs
pub fn prepare_word(word: &Word) -> String {
Expand Down
Loading

0 comments on commit 188e6d6

Please sign in to comment.