Skip to content

Commit

Permalink
Added finding unused imports.
Browse files Browse the repository at this point in the history
Non-traits and impls.
  • Loading branch information
orizi committed Aug 6, 2024
1 parent b34b005 commit 6068d13
Show file tree
Hide file tree
Showing 81 changed files with 349 additions and 71 deletions.
1 change: 1 addition & 0 deletions corelib/src/array.cairo
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
use core::traits::IndexView;

use core::box::BoxTrait;
#[allow(unused_imports)]
use core::gas::withdraw_gas;
use core::option::OptionTrait;
use core::serde::Serde;
Expand Down
1 change: 1 addition & 0 deletions corelib/src/bytes_31.cairo
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
use core::traits::{Into, TryInto};
use core::option::OptionTrait;
#[allow(unused_imports)]
use core::integer::{u128_safe_divmod, u128_to_felt252};
use core::RangeCheck;

Expand Down
1 change: 1 addition & 0 deletions corelib/src/debug.cairo
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
use core::array::ArrayTrait;
use core::traits::Into;
#[allow(unused_imports)]
use core::option::Option;

/// Usage:
Expand Down
1 change: 1 addition & 0 deletions corelib/src/ecdsa.cairo
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ use core::{ec, ec::{EcPoint, EcPointTrait, EcStateTrait}};
use core::option::OptionTrait;
use core::math;
use core::traits::{Into, TryInto};
#[allow(unused_imports)]
use core::zeroable::IsZeroResult;

/// Checks if (`signature_r`, `signature_s`) is a valid ECDSA signature for the given `public_key`
Expand Down
23 changes: 23 additions & 0 deletions corelib/src/lib.cairo
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
pub mod traits;
#[feature("deprecated-index-traits")]
#[feature("deprecated-op-assign-traits")]
#[allow(unused_imports)]
use traits::{
Add, AddEq, BitAnd, BitNot, BitOr, BitXor, Copy, Div, DivEq, DivRem, Drop, Mul, MulEq,
PartialEq, PartialOrd, Rem, RemEq, Sub, SubEq, TupleSize0Copy, TupleSize0Drop, Not, Neg, Into,
Expand Down Expand Up @@ -109,6 +110,7 @@ pub extern type SegmentArena;

/// felt252.
mod felt_252;
#[allow(unused_imports)]
use felt_252::{Felt252One, Felt252Zero};

#[derive(Copy, Drop)]
Expand Down Expand Up @@ -227,46 +229,56 @@ extern fn drop<T>(obj: T) nopanic;

/// Boxes.
pub mod box;
#[allow(unused_imports)]
use box::{Box, BoxTrait};

/// Nullable
pub mod nullable;
#[allow(unused_imports)]
use nullable::{Nullable, NullableTrait, match_nullable, null, nullable_from_box};

/// Module for `Array` and other continuous same type collections.
pub mod array;
#[allow(unused_imports)]
use array::{Array, ArrayTrait};

/// Span.
#[allow(unused_imports)]
use array::{Span, SpanTrait};

/// Dictionary.
pub mod dict;
#[allow(unused_imports)]
use dict::{
Felt252Dict, SquashedFelt252Dict, felt252_dict_new, felt252_dict_squash, Felt252DictTrait
};

/// Result.
pub mod result;
#[allow(unused_imports)]
use result::{Result, ResultTrait};

/// Option.
pub mod option;
#[allow(unused_imports)]
use option::{Option, OptionTrait};

/// Clone.
pub mod clone;
#[allow(unused_imports)]
use clone::Clone;

/// EC.
pub mod ec;
#[allow(unused_imports)]
use ec::{EcOp, EcPoint, EcState};

pub mod ecdsa;

/// Integer.
#[feature("corelib-internal-use")]
pub mod integer;
#[allow(unused_imports)]
use integer::{
i8, I8IntoFelt252, i16, I16IntoFelt252, i32, I32IntoFelt252, i64, I64IntoFelt252, i128,
I128IntoFelt252, NumericLiteral, u128, u128_is_zero, u8, u16, u32, u64, u256, Felt252TryIntoU8,
Expand All @@ -275,6 +287,7 @@ use integer::{
};
#[feature("corelib-internal-use")]
#[deprecated(feature: "corelib-internal-use", note: "Use `core::num::traits::Sqrt` instead")]
#[allow(unused_imports)]
use integer::{u128_sqrt, u256_sqrt};

/// Math.
Expand All @@ -292,11 +305,13 @@ pub mod cmp;

/// Module for handling gas operations.
pub mod gas;
#[allow(unused_imports)]
use gas::{BuiltinCosts, GasBuiltin, get_builtin_costs};


/// Panics.
pub mod panics;
#[allow(unused_imports)]
use panics::{panic, Panic, PanicResult};

pub enum never {}
Expand Down Expand Up @@ -325,10 +340,12 @@ pub mod sha256;

/// Pedersen
pub mod pedersen;
#[allow(unused_imports)]
use pedersen::Pedersen;

/// Poseidon
pub mod poseidon;
#[allow(unused_imports)]
use poseidon::Poseidon;

/// Debug.
Expand All @@ -339,28 +356,33 @@ pub mod fmt;
/// Starknet
#[feature("corelib-internal-use")]
pub mod starknet;
#[allow(unused_imports)]
use starknet::System;

/// Internals.
pub mod internal;

/// Zeroable.
pub mod zeroable;
#[allow(unused_imports)]
use zeroable::{Zeroable, NonZero};

/// bytes31.
pub mod bytes_31;
#[allow(unused_imports)]
use bytes_31::{
bytes31, bytes31_const, Bytes31IndexView, Bytes31IntoFelt252, Bytes31Trait,
Felt252TryIntoBytes31
};

/// BytesArray.
pub mod byte_array;
#[allow(unused_imports)]
use byte_array::{ByteArray, ByteArrayIndexView, ByteArrayStringLiteral, ByteArrayTrait};

/// String.
pub mod string;
#[allow(unused_imports)]
use string::StringLiteral;

/// to_byte_array.
Expand All @@ -376,6 +398,7 @@ pub mod testing;
pub mod metaprogramming;

/// Preludes.
#[allow(unused_imports)]
mod prelude;

/// Iterators.
Expand Down
1 change: 1 addition & 0 deletions corelib/src/math.cairo
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
#[allow(unused_imports)]
use core::zeroable::{IsZeroResult, NonZeroIntoImpl, Zeroable};
use core::traits::{Into, TryInto};
use core::option::OptionTrait;
Expand Down
8 changes: 8 additions & 0 deletions corelib/src/starknet.cairo
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
#[allow(unused_imports)]
use core::box::Box;
use core::option::OptionTrait;
#[allow(unused_imports)]
use core::array::Span;
use core::traits::Into;
use core::traits::TryInto;
Expand All @@ -9,6 +11,7 @@ use core::zeroable::Zeroable;
pub mod storage_access;
/// Re-imports
pub use storage_access::{Store, StorageAddress};
#[allow(unused_imports)]
use storage_access::{
StorePacking, StorageBaseAddress, storage_base_address_const, storage_base_address_from_felt252,
storage_address_from_base, storage_address_from_base_and_offset, storage_address_to_felt252,
Expand All @@ -17,6 +20,7 @@ use storage_access::{

/// Module containing all the extern declaration of the syscalls.
pub mod syscalls;
#[allow(unused_imports)]
use syscalls::{
call_contract_syscall, deploy_syscall, emit_event_syscall, get_block_hash_syscall,
get_execution_info_syscall, library_call_syscall, send_message_to_l1_syscall,
Expand All @@ -31,6 +35,7 @@ pub mod secp256r1;
/// ContractAddress
pub mod contract_address;
pub use contract_address::{ContractAddress, contract_address_const};
#[allow(unused_imports)]
use contract_address::{
ContractAddressIntoFelt252, Felt252TryIntoContractAddress, contract_address_to_felt252,
contract_address_try_from_felt252
Expand All @@ -39,17 +44,20 @@ use contract_address::{
/// EthAddress
pub mod eth_address;
pub use eth_address::EthAddress;
#[allow(unused_imports)]
use eth_address::{
EthAddressIntoFelt252, EthAddressSerde, EthAddressZeroable, Felt252TryIntoEthAddress
};

/// EthSignature
pub mod eth_signature;
#[allow(unused_imports)]
use eth_signature::verify_eth_signature;

/// ClassHash
pub mod class_hash;
pub use class_hash::ClassHash;
#[allow(unused_imports)]
use class_hash::{
ClassHashIntoFelt252, Felt252TryIntoClassHash, class_hash_const, class_hash_to_felt252,
class_hash_try_from_felt252
Expand Down
1 change: 1 addition & 0 deletions corelib/src/starknet/eth_address.cairo
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
use core::debug::PrintTrait;
#[allow(unused_imports)]
use core::integer::{u128_safe_divmod, U128TryIntoNonZero, U256TryIntoFelt252};
use core::option::{Option, OptionTrait};
use core::serde::Serde;
Expand Down
1 change: 1 addition & 0 deletions corelib/src/starknet/eth_signature.cairo
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
use core::option::OptionTrait;
#[allow(unused_imports)]
use starknet::{
EthAddress,
secp256_trait::{
Expand Down
1 change: 1 addition & 0 deletions corelib/src/starknet/info.cairo
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
#[allow(unused_imports)]
use starknet::{
SyscallResultTrait, SyscallResult, syscalls::get_execution_info_syscall,
contract_address::ContractAddress
Expand Down
1 change: 1 addition & 0 deletions corelib/src/starknet/secp256_trait.cairo
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
use core::array::ArrayTrait;
use core::math::{u256_mul_mod_n, u256_inv_mod};
use core::option::OptionTrait;
#[allow(unused_imports)]
use starknet::{eth_address::U256IntoEthAddress, EthAddress, SyscallResult, SyscallResultTrait};
use core::traits::{Into, TryInto};
use core::integer::U256TryIntoNonZero;
Expand Down
1 change: 1 addition & 0 deletions corelib/src/starknet/secp256k1.cairo
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@

use core::option::OptionTrait;
use core::gas::GasBuiltin;
#[allow(unused_imports)]
use starknet::{
secp256_trait::{
Secp256Trait, Secp256PointTrait, recover_public_key, is_signature_entry_valid, Signature
Expand Down
1 change: 1 addition & 0 deletions corelib/src/starknet/secp256r1.cairo
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@

use core::option::OptionTrait;
use core::gas::GasBuiltin;
#[allow(unused_imports)]
use starknet::{
EthAddress, secp256_trait::{Secp256Trait, Secp256PointTrait}, SyscallResult, SyscallResultTrait
};
Expand Down
2 changes: 2 additions & 0 deletions corelib/src/starknet/storage.cairo
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
use core::traits::Into;
#[allow(unused_imports)]
use core::pedersen::HashState;
use core::hash::HashStateTrait;
use starknet::storage_access::StorageBaseAddress;
#[allow(unused_imports)]
use starknet::SyscallResult;
use starknet::storage_access::storage_base_address_from_felt252;

Expand Down
1 change: 1 addition & 0 deletions corelib/src/starknet/storage/map.cairo
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
#[allow(unused_imports)]
use super::{
StoragePath, Mutable, StoragePathHashState, StoragePathTrait, StoragePathUpdateTrait,
MutableTrait, StorageAsPointer, StoragePointerReadAccess, StoragePointerWriteAccess,
Expand Down
2 changes: 1 addition & 1 deletion corelib/src/test/array_test.cairo
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
use core::test::test_utils::{assert_eq, assert_ne};
use core::test::test_utils::assert_eq;
use core::iter::{IntoIterator, Iterator};

#[test]
Expand Down
2 changes: 1 addition & 1 deletion corelib/src/test/box_test.cairo
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
use core::test::test_utils::{assert_eq, assert_ne};
use core::test::test_utils::assert_eq;

#[test]
fn test_box_unbox_felt252s() {
Expand Down
1 change: 0 additions & 1 deletion corelib/src/test/circuit_test.cairo
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ use core::circuit::{
AddInputResultTrait, CircuitInputs,
};

use core::test::test_utils::assert_eq;
use core::traits::TryInto;

#[test]
Expand Down
2 changes: 1 addition & 1 deletion corelib/src/test/cmp_test.cairo
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
use core::cmp::{max, min, minmax};
use core::test::test_utils::{assert_eq, assert_ne};
use core::test::test_utils::assert_eq;

// Integer tests

Expand Down
2 changes: 1 addition & 1 deletion corelib/src/test/dict_test.cairo
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
use core::dict::{Felt252DictEntryTrait, Felt252Dict};
use core::test::test_utils::{assert_eq, assert_ne};
use core::test::test_utils::assert_eq;
use core::nullable;

#[test]
Expand Down
2 changes: 1 addition & 1 deletion corelib/src/test/ec_test.cairo
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
use core::ec::{EcPoint, EcPointTrait, EcStateTrait};
use core::ecdsa;
use core::option::OptionTrait;
use core::test::test_utils::{assert_eq, assert_ne};
use core::test::test_utils::assert_eq;
use core::traits::{Into, TryInto};

#[test]
Expand Down
2 changes: 1 addition & 1 deletion corelib/src/test/felt_test.cairo
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
use core::test::test_utils::{assert_eq, assert_ne};
use core::test::test_utils::assert_eq;

#[test]
fn test_felt252_operators() {
Expand Down
2 changes: 1 addition & 1 deletion corelib/src/test/hash_test.cairo
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
use core::test::test_utils::{assert_eq, assert_ne};
use core::test::test_utils::assert_eq;
use core::hash::{HashStateTrait, HashStateExTrait};
use core::poseidon::PoseidonTrait;

Expand Down
1 change: 0 additions & 1 deletion corelib/src/test/keccak_test.cairo
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
use starknet::SyscallResultTrait;
pub use core::keccak;
use core::test::test_utils::{assert_eq, assert_ne};

#[test]
fn test_keccak_syscall() {
Expand Down
2 changes: 1 addition & 1 deletion corelib/src/test/nullable_test.cairo
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
use core::test::test_utils::{assert_eq, assert_ne};
use core::test::test_utils::assert_eq;
use core::nullable::null;

#[test]
Expand Down
1 change: 0 additions & 1 deletion corelib/src/test/sha256_test.cairo
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
use core::test::test_utils::{assert_eq, assert_ne};
use core::starknet::SyscallResultTrait;
use core::sha256::compute_sha256_byte_array;

Expand Down
Loading

0 comments on commit 6068d13

Please sign in to comment.